Running Developer Command Prompt for Visual Studio
The Visual Studio developer command
VsDevCmd.bat only works with the cmd.exe command line shell/processor, which is still the native command prompt in Windows. Try writing some command in Start->Run or Explorer’s address bar, and you’ll find that you need to use the cmd/batch command syntax (for example, using
%SOME_NAME% syntax for variables).
What if you want to us
VsDevCmd.bat? You want the stuff it adds temporarily to the
PATH and all the other goodies it brings, but prefer to work in Powershell?
Using VsDevCmd With PowerShell
You can try to run
VsDevCmd.bat from PowerShell, but this will execute another command prompt shell on top of it.
However, you can also easily do the opposite. Run the
VsDevCmd.bat, and from the command prompt, just type
PowerShell and press ENTER. The new Powershell session will inherit all the fluff that
VsDevCmd.bat added to the command prompt session.
A Quick Shortcut
You can always have a simple shortcut to load
VsDevCmd.bat with Powershell instead of writing everytime.
Simply create a new text file, and enter the following in it:
Save the file and change its extension to
.bat. When you run it, it will run the command prompt and keep it open, run
VsDevCmd.bat, and then
You can test it by running, ensuring the prompt shows the
PS > prompt for PowerShell, then run
msbuild to ensure it was added to the
Using By Default, ConEmu
Among many other things, ConEmu allows you to create tasks that can be executed by default when you open a new console tab. This allows you to have for example some preset (task) for sat Bash/cygwin, another for cmd.exe, another for PowerShell, etc. Maybe even another task that loads some extra variables or whatever that you don’t want always attached, but still want them handy when you use the console. It also allows you to optionally choose one task to be the default when you open ConEmu.
So, for me, the task I set to be the default in ConEmu is the following:
* > bits are ConEmu specific, telling it to run task as admin and make it active tab (if you can set multiple tabs in the same task). And the
-new_console: switch allows passing other parameters to ConEmu when starting, like
d:D:_data, which sets the start-up directory to a prefered directory I have. The rest in the middle is the simple command which calls
VsDevCmd.bat and then starts PowerShell.