All of these scripts are used for various development activities from the console, not from the IDE. For building, linking, decompiling, etc.
VsDevCmd.bat
applies to the entire Visual Studio environment. Including configuring the C / C++ build environment. It is also for .NET with C# etc. By default, it aims to build from x86 for x86 (this can be changed with arguments passed to this script). It should be noted that there is a PowerShell version of this script.
https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022
vcvarsall.bat
it is mainly used to configure the C / C++ build environment. You can use arguments for this script to change the target and host architectures. This script also relates to scripts where the target and host architectures are already selected and do not need to be passed in the script invocation arguments.
https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170
If you will be doing C / C++ activities it is better to use vcvarsall.bat
. Because this script, according to Microsoft's documentation from the link above and comments from the vcvarsall.bat
file, can change some system variables to configure the build type for C / C++ but not for dot NET.
The difference may arise as you use more different workloads and additional packages.
For example, I have .NET desktop development
and Desktop development with C++
and VS IDE 2022
installed and after running the vcvarsall.bat
script, it additionally adds the Platform
system variable.
At some point, script vcvarsall.bat
finally runs script VsDevCmd.bat
.
I don't know if it will be 100% safe to use VsDevCmd.bat
script to build C / C++. I'm unable to determine when the difference will occur and what will be affected by the additionally set system variables. According to Microsoft's documentation, BAT scripts are generated (adapted) for the functionality installed in Visual Studio.
It's best if someone from Microsoft spoke about this part.
MSBuild, nmake and cmake can be run from both scripts.
related:
https://learn.microsoft.com/en-us/answers/questions/635862/what39s-the-differences-between-34developer-comman.html
https://learn.microsoft.com/en-us/visualstudio/msbuild/build-process-overview?view=vs-2022#visual-studio-builds-vs-msbuildexe-builds