https://stackoverflow.com/posts/46015587/edit
临时解决方案:创建三个文件g3.bat
,g6.bat
和gg.bat
,并将它们放在PATH目录之一中。它们允许暂时添加或删除mingw32或mingw64在PATH中。
g3.bat
:
call gg.bat
SET PATH=%PATH%C:\msys64\mingw32\bin;
g6.bat
:
call gg.bat
SET PATH=%PATH%C:\msys64\mingw64\bin;
gg.bat
:
set PATH=%PATH:C:\msys64\mingw32\bin;=%
set PATH=%PATH:C:\msys64\mingw64\bin;=%
调用此命令以检查结果:
echo %PATH%
第二版,尝试不使用前导;
它几乎可以正常工作,但是gg.bat
仍然会留下前导的;
。我可以使用set PATH=%PATH:;C:\msys64\mingw32\bin=%
代替(注意%PATH:
右侧的额外;
),但如果C:\msys64\mingw32\bin
在PATH的开头,它将会出现问题。
此外,我不确定是否需要""
。
g3.bat
:
call gg.bat
SET PATH=%PATH%;C:\msys64\mingw32\bin
g6.bat
:
call gg.bat
SET PATH=%PATH%;C:\msys64\mingw64\bin
gg.bat
:
set PATH=%PATH:C:\msys64\mingw32\bin=%
set PATH=%PATH:C:\msys64\mingw64\bin=%
set "PATH=%PATH:;;=;%"
第三版,“随便什么”:
gg.bat
:
set PATH=%PATH:;C:\msys64\mingw32\bin=%
set PATH=%PATH:;C:\msys64\mingw64\bin=%
set PATH=%PATH:C:\msys64\mingw32\bin;=%
set PATH=%PATH:C:\msys64\mingw64\bin;=%
set PATH=%PATH:C:\msys64\mingw32\bin=%
set PATH=%PATH:C:\msys64\mingw64\bin=%
set PATH=%PATH:;;=;%