Extra VS Code Settings for Windows

I had to change both settings for the terminals… Once I found each root directory then I restarted VS Code and it worked. One point, I needed to visit each file to get the source as search took me to shortcuts.

I wanted to point out that it is quite simple to get PowerShell to work using the Posh-VS module instead of changing the default shell in vscode to CMD. This is very handy if you already use VS Code & PowerShell and do not want to change the default shell to CMD.

If you do it this way you must not have the changes to settings.json described in this video.

Posh-VS GitHub Link

Posh-VS PowerShell Gallery Link

Steps:

Revert any changes from the video in your settings.json

Launch a new PowerShell session as admin (Search the Start menu for “PowerShell”, right click it, select “Run as administrator”)

Install the module from the PowerShell Gallery:

Install-Module posh-vs

Accept prompt about downloading from an unknown repository with a or y

Launch a new PowerShell session (not as admin) either in VSCode or from the start menu, and run the following to configure your PowerShell profile to import the Visual Studio Developer Environment:

Install-PoshVs

Reload your PowerShell Profile:

. $profile

Run cl, and you should see the expected output from the compiler:

cl

Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27024.1 for x86 Copyright (C) 
Microsoft Corporation. All rights reserved. usage: cl [ option... ] filename... [ /link linkoption... ]
1 Like

I just found the location on which I installed Visual Studio, I did not go to the classic installation, but I put it on the E disk for more memory and it would look like this:

{
“terminal.integrated.shell.windows”: “cmd.exe”,
“terminal.integrated.shellArgs.windows”: [
“/k”, “E:\Visual Studio 19\Common7\Tools\VsDevCmd.bat”
]
}

Probably you will not be the same this way, but the point is to find where you installed Visual Studio and copy that location.

Hi, I’m having a bit of trouble getting through this part. I am unsure of what to do.
What I get is “‘cl’ is not recognized as an internal or external command,
operable program or batch file.”
Can anyone help me out? Please and thank you.vs%20code%20internal%20or%20external

EDIT: Got it to work by rebooting visual studio code and adding “C:\WINDOWS\System32\cmd.exe”

I have the same problem. :frowning:

You people that are just typing ‘cl’ with nothing after it are mis-using the command.

You need to type ‘cl FILENAME’ to compile the file located in the directory you’re typing from.

(FILENAME must be a valid file with the .cpp extension included…)

If it STILL doesn’t work, it’s because of other issues, many listed above in this thread. Just don’t use ‘cl’ by itself.

thanks bro … worked like a charm

This is what I used to get mine working

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

Thank you

Thank you for this comment! It helped me fix my cl error!

thank you, I got it to work.

Great, this worked!

Thank you! Works as intended now.

Hey everyone! Does anyone know what "/k" does? why can’t I just type in the location of the .bat file? also the brackets mean that it’s an array right? here is info on array: https://javascript.info/array
I don’t know java so lol.

  • Thank-you!

https://social.technet.microsoft.com/Forums/Azure/en-US/332d454b-6265-48bb-8698-9533b12b8863/cmd-c-cmd-k-start-call-batch-files-how-to-use?forum=winserverManagement

hey friends, I hope u all guys are well.
I’m getting this error while executing the program.

     'hello' is not recognized as an internal or external command,
      operable program or batch file."

Please help me :roll_eyes:

Thanks a ton for this one! I was wracking my brain trying to figure out why I could not for the life of me get it to find it even though plenty of people here seemed to have figured it out. Just needed to swap in “community” for the fix. Was getting frustrated because this tripped me up so bad as soon as the lessons actually started.

i have the same problem :frowning: pls someone help us

This helped me a lot. That you .

Privacy & Terms