Extra VS Code Settings for Windows

Here’s the code you need to add to settings.json in VS Code in order to be able to use the Developer Command Prompt in Windows 10…

{
    "terminal.integrated.shell.windows": "cmd.exe",
    "terminal.integrated.shellArgs.windows": [
        "/k", "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\Common7\\Tools\\VsDevCmd.bat"
    ]
}

You access settings as follows…

  • File > Preferences > Settings
  • Search settings for “shell”
  • Choose “Edit in settings.json”
6 Likes

Cool, worked for me:
Before:
before

After:

after

1 Like

Actually had to edit. Needed to change BuildTools to Professional. I imagine community and enterprise are the same.

3 Likes

Hi, when i change the codes in the editors and if i terminal it, i would get the same result before the changes unless i compile it again ( by typing cl main.cpp in terminal).
Is there any workaround so i don’t have to compile it everytime in terminal?

Thought I would share a solution to a minor snag I ran into. I started off with visual studio community installed along with an older version of the build tools (Microsoft ® C/C++ Optimizing Compiler Version 15.Something for x86) since it appeared I already had the developer command prompt for VS 2017 I skipped the download step.
Everything went find until I tried to run cl in the terminal. It wasn’t recognized even after making the changes to the settins.json file. I only needed to redownload and install the c++ build tools linked in “Install Windows 10 C++ Compiler” and everything was fine.

2 Likes

Hello, I’m experiencing a problem. I keep getting this error Screenshot%20(17)

1 Like

Hello everyone, if anyone is having a similar problem to me, I found a fix. What you go is change “cmd.exe” to the path your command executable file is located. In my case, it was “C:\Windows\System32\cmd.exe”. I’ve attached a screenshot. Hopefully, I’ve helped a few people out there!
Screenshot%20(18)_LI

7 Likes

What did you do exactly? I’m getting the exact same error message.

Nevermind I got it working. Changing the year of in the directory to the version of visual studio that I had fixed the issue.

Example:

Before: {
“terminal.integrated.shell.windows”: “cmd.exe”,
“terminal.integrated.shellArgs.windows”: [
“/k”, “C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsDevCmd.bat”
]
}

After: {
“terminal.integrated.shell.windows”: “cmd.exe”,
“terminal.integrated.shellArgs.windows”: [
“/k”, “C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat”
]
}

6 Likes

Thanks for this - had same issue as I just downloaded VS 2019. Worked like a charm.

ok im having the worst issue when i installed VS2019 i put it on the D:\ so now im trying this

“terminal.integrated.shell.windows”: “cmd.exe”,
“terminal.integrated.shellArgs.windows”: [
“/k”, “D:\Unreal engine\Visual Studio\Common7\Tools\VsDevCmd.bat”

i have also tried
“terminal.integrated.shell.windows”: “C:\Windows\System32\cmd.exe”,
“terminal.integrated.shellArgs.windows”: [
“/k”, “D:\Unreal engine\Visual Studio\Common7\Tools\VsDevCmd.bat”

but i cannot get the Cl function to work

1 Like

So update i have went to a fresh copy of windows now and installed this specifially on my laptop this is the error i keep getting i have tried to search with no luck can someone please help me out

4 Likes

I had the same problem a few days back, i solved it by entering
View > Command Palette > Terminal: Select Default Shell > Command Prompt
cmd%20error%20solved

Hope i’ve helped

10 Likes

For me it says that the command “C:\Program” couldnt be found, help!

Did you follow the comment before yours?

I have this problem. I put the code in and when i open a new terminal this happens. ‘C:\Program’ is not recognized as an internal or external command,
operable program or batch file.

and then i type cl and i get this
‘cl’ is not recognized as an internal or external command,
operable program or batch file.

1 Like

Did you try rebooting? Worked for me.

1 Like

If anyone is using Visual Studio instead of VS Code, here is an easy walk through to setup the Dev Command Prompt.

https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs

I am also getting:

‘cl’ is not recognized as an internal or external command,
operable program or batch file.

UPDATE: Got it to work by combining some of the fixes suggested above in previous comments, thanks

For those running Visual Studio 2019 -

{
“terminal.integrated.shell.windows”: “cmd.exe”,
“terminal.integrated.shellArgs.windows”: [
“/k”, “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat”
]
}

2 Likes

Privacy & Terms