3

Since I cannot locate Native Tools CMD under the Tools menu, I try to manually add it in External Tools. Few questions:

  1. Regardless of what I choose for Command (ARM, x86 or x64 etc.), Command is always C:\Windows\System32\cmd.exe. Why the different CMDs end up having the same path to the native System32's CMD?
  2. Referring to this answer, I should insert /k "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat" to the arguments - what is the /k and what is the bat for this argument? Why do I need to pass a path as an argument to the command prompt?
  3. What is Initial Directory?

Screenshot

Community
  • 1
  • 1
KMC
  • 19,548
  • 58
  • 164
  • 253

2 Answers2

6

Why the different CMDs end up having the same path to the native System32's CMD?

The VS2015* CMDs are just cmd.exe with some environment variables already set up for you. so for example instead of typing "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe" to run InstallUtil.exe you will just type InstallUtil and it will work. if you didn't set up the environment variables you will get an error message saying that 'installutil' is not recognized as an internal or external command, operable program or batch file.

what is the /k and what is the bat for this argument? Why do I need to pass a path as an argument to the command prompt?

/k is a parameter for cmd.exe and what it does is run the commands specified by the string that follows (in this case it will execute what's inside "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat" and will carry out).

What is Initial Directory?

Initial directory is used to specify the working directory that your cmd.exe instance will start in

So in the end you'll have something like this for Visual Studio 2015:

enter image description here

The "arguments" for VS2015 is :

/k "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat"

Nasreddine
  • 36,610
  • 17
  • 75
  • 94
  • But the cmd path is pointing to the same cmd in the system32 folder with no setup of any environment variables. Second is why do need to run the command VsDevCmd.bat? I thought the native tools command prompt is simply another instance of cmd to debug a program so what is with all these extra arguments nd commands? – KMC Jun 29 '15 at 05:14
  • Yes, the native tools command prompt is just an instance with something extra and `VsDevCmd.bat` will do just that, setup all those extra environment variables for you. you can read its content using a text editor to see what it does. – Nasreddine Jun 29 '15 at 07:22
0

I took a look at my start menu and right clicked on Developer Command Prompt for VS2015. Copied target %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat""

MSBuild Command Prompt for VS2015 Copied target %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsMSBuildCmd.bat""

https://connect.microsoft.com/VisualStudio/feedback/details/747807/vs2012-x64-native-tools-command-prompt