MinGW 安装并运行。环境变量已检查并正确,但 gcc -v 或 g++ --version 不起作用

MinGW installed, and works. Environment variables checked, and correct, however gcc -v or g++ --version doesn't work

我正在尝试安装并检查 MinGW 以便在 MSVSCode 中进行调试。

我有 运行 MinGW 安装管理器 (mingw-get) GUI 来安装 MinGW。 我安装了以下内容:

并且我已经验证它正在工作,如下所示:-

C:\MinGW\bin>g++ --version
g++  <MinGW.org GCC-8.2.0-5> 8.2.0
Copyright <c> 2018 Free Software Foundation, Inc.
This is free software; see the source for copying 
conditions.  There is No warranty; not even for 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

用户变量路径:-

C:\ProgramData\Oracle\Java\javapath;c:\Program Files(x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLSClient\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files (x86)\Windows Kits.1\Windows Performance Toolkit\;C:\Program Files\MATLAB\R2016b\bin;C:\Program Files (x86)\MySQL\MySQL Utilities 1.6\;C:\Program Files\nodejs\;C:\Program Files\CMake\bin;C:\Program Files\Microsoft VSCode\bin;C:\Users\T\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\T\AppData\Local\Programs\Python\Python37\;C:\Program Files (x86)\MySQL\MySQL Server 5.7\bin;C:\Users\T\AppData\Roaming\npm; C:\MinGW\bin;

系统变量路径:-

C:\ProgramData\Oracle\Java\javapath;c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLSClient\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files (x86)\Windows Kits.1\Windows Performance Toolkit\;C:\Program Files\MATLAB\R2016b\bin;C:\Program Files (x86)\MySQL\MySQL Utilities 1.6\;C:\Program Files\nodejs\;C:\Program Files\CMake\bin;C:\Program Files\Microsoft VS Code\bin; C:\MinGW\bin;

如果我输入

C:\Users>gcc -v

我收到错误消息

'gcc' is not recognised as an internal or external command, operable program or batch file.

但是,如果我输入

C:\Users>set PATH=C:\MinGW\bin;%PATH%

然后我写

C:\Users>gcc -v

然后我得到...

Using built-in specs.
COLLECT_GCC=gcc 
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/8.2.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-8.2.0/configure --build=x86_64- 
pc-linux-gnu --host=mingw32 --target=mingw32 --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-8.2.0-5' --with-gmp=/mingw --with-mpfr=/mingw --with-mpc=/mingw --enable-static --enable-shared --enable-threads -- with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs -- with-libiconv-prefix=
/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with-isl=/mingw --enable-libgomp --disable-libvtv --enable-nls --disable- build-format-warnings Thread model: win32
gcc version 8.2.0 (MinGW.org GCC-8.2.0-5)

但是,只要此命令控制台 window 处于打开状态。

我的操作系统是 Windows 7 Home Premium Service Pack 1 64 位操作系统。

有没有什么方法可以让它工作,这样我就不需要每次都写 set PATH,这样它就可以在 MSVSCode 中工作了?

非常感谢任何帮助建议

除非是拼写错误,否则问题中粘贴的环境变量似乎包含额外的 space:

...C:\Program Files\Microsoft VS Code\bin; C:\MinGW\bin;
                                          ^

这使得系统搜索(不存在的)路径“C:\MinGW\bin”而不是正确的 "C:\MinGW\bin"。