I am trying to make "x64 Native Tools Command Prompt for VS 2019" as an integrated console for Visual Studio Code. There was a solution for doing so with Developer Powershell, but I have not seen one for what I'm trying to attempt. I know that "x64 Native Tools Command Prompt for VS 2019" is a shortcut to
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
, but running it includes a few forms I'm not familiar with. For example, running C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
directly I imagine does the proper setup to enable me to compile for a 64-bit target, but the console does not stick around afterwards (it closes subsequently). The shortcut works for some reason by having %comspec% /k
prepended to the path as its target. So, running
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
with Run (win+r) gives me what I need. How do I replicate this in VS Code in settings.json
just like with any other terminal/console profile? I've attempted the following, which I've taken from How to make visual studio code run vcvarsx86_arm64.bat instead of vcvarsall.bat directly?:
"x64 Native Tools Command Prompt for VS 2019": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [
"/d",
"/c",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat",
"&"
],
"icon": "terminal-cmd"
},
The is the config which worked for me:
"DevCmd": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [
"/d",
"/k",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat",
"amd64"]
}
In your example the argument /c
means 'carry out the command and return', which in this scenario has the effect of'exit the shell'.
/k
means 'carry out the command and remain in the shell'.
/d
means _'don't run the Auto commands for CMD in the registry.
&
is the call operator and is not needed. It's typically for chaining commands together on single line.
To get a complete list and explanation of available arguments run this in a Command Prompt:
%comspec% /?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With