-1

I am a beginner and i used a YouTube video as my guide to install mingw and gcc and gdb and created a hello.c file and as per the instructions I clicked on "configure default built task" and then closed and reopened vscode and then again i clicked on "Run Build task". in the terminal it said

Starting build...
C:\msys64\mingw64\bin\gcc.exe -fdiagnostics-color=always -g -Wall C:\Users\chait\Desktop\cp\programs\HelloWorld\hello.c -o C:\Users\chait\Desktop\cp\programs\HelloWorld\hello.exe
'cmd' is not recognized as an internal or external command,
operable program or batch file.

Build finished with warning(s).

Terminal will be reused by tasks, press any key to close it.
Stephan
  • 50,835
  • 10
  • 55
  • 88
  • Does this answer your question? [What is the reason for "X is not recognized as an internal or external command, operable program or batch file"?](https://stackoverflow.com/questions/41454769/what-is-the-reason-for-x-is-not-recognized-as-an-internal-or-external-command) The reason 8 is most likely the problem. The __local__ environment variable `PATH` does not contain anymore as first (or second) folder path `%SystemRoot%\System32` which is usually `C:\Windows\System32`. – Mofi May 27 '22 at 15:27
  • IDEs used for C/C++ development use the `PATH` as defined by `explorer.exe` on starting the IDE and prepend at the beginning the path of the directory containing the executables of the used compiler, i.e. the __local__ `PATH` begins for the build process with `C:\msys64\mingw64\bin;C:\Windows\System32;C:\Windows;` and the other directories. In your case __local__ `PATH` is most likely just `C:\msys64\mingw64\bin` or is not defined at all. How to fix that depends on how you start the build process. Which IDE do you use? How is __system__ and __user__ `PATH` defined on your machine? – Mofi May 27 '22 at 15:34
  • hey sorry for taking so long to reply. I use vs code i used set path in cmd and it showed this Path=C:\Program Files (x86)\Common `Files\Oracle\Java\javapath;C:\msys64\mingw64\bin;C:\msys64\mingw64\bin;C:\Users\chait\AppData\Local\Microsoft\WindowsApps;C:\Users\chait\AppData\Local\Programs\Microsoft VS Code\bin;C:\MinGW\bin;;C:\Users\chait\AppData\Local\Programs\Microsoft VS Code\bin PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC` – Chaitanya Harshan Jun 04 '22 at 02:39
  • Sorry that I have to tell you that, but you have corrupted especially the __system__ environment variable `Path` very heavily. All the default paths a new Windows installation has are missing in __local__ `Path` which means they are missing in __system__ `Path`. `PATHEXT` is okay as being default with the default list of file extensions. So I strongly recommend to fix your __system__ and __user__ `Path` configuration by clicking on Windows __Start__ menu button, typing on keyboard __environment__ and clicking on the suggested item __Edit the system environment variables__ in Windows language. – Mofi Jun 04 '22 at 08:21
  • In the upper list with the __user__ environment variables should be `Path` defined with the following folder paths separated by semicolons: `C:\Users\chait\AppData\Local\Microsoft\WindowsApps;C:\msys64\mingw64\bin;C:\MinGW\bin;C:\Users\chait\AppData\Local\Programs\Microsoft VS Code\bin` or even better with `%LOCALAPPDATA%\Microsoft\WindowsApps;C:\msys64\mingw64\bin;C:\MinGW\bin;%LOCALAPPDATA%\Programs\Microsoft VS Code\bin`. You see that I removed duplicate folder paths from the list of folder paths. – Mofi Jun 04 '22 at 08:29
  • In the lower list with the __system__ environment variables should be `Path` defined with the following folder paths separated by semicolons: `%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\;%SystemRoot%\System32\OpenSSH\;%CommonProgramFiles(x86)%\Oracle\Java\javapath`. The missing default folder paths in __system__ `Path` is the reason for the error message. The folder path ``%SystemRoot%\System32\OpenSSH\`` is in __system__ `Path` by default only on using 64-bit Windows 10 1809 or a newer Windows version. – Mofi Jun 04 '22 at 08:35
  • Run the program `winver.exe` if you don't know which Windows is used by you. The last folder path `%CommonProgramFiles(x86)%\Oracle\Java\javapath` is not a default folder path in __system__ environment variable `Path`. That folder path is added by the installer of Java to __system__ `Path`. You have installed obviously Java. After fixing __user__ and __system__ `Path` and clicking on button __OK__ to save the two redefined `Path` environment variables, restart Windows so that all processes work with the redefined `Path`. – Mofi Jun 04 '22 at 08:37

0 Answers0