How to: Use Cmder as the Developer Command Prompt for Visual Studio

It’s not of today that I’m a little bit tired of the default Windows Command Prompt (cmd). Then, I decided to use something more enhanced and that’s why I chose Cmder (http://cmder.net/). This utility is pretty cool and I encourage you to use it either!

But since then there was something that always bothered me: that time when I needed to use the Developer Command Prompt for Visual Studio. Damn, that thing opening the default Windows Command Prompt was always bizarre, empty and weak.

But today is the day that I’m going to wipe this evil from my life. And I did it. And as I wish all the best to all the humanity, I’m going to share the steps with you all. Here’s how to set up this piece of haven in your developer station:

1st: Set up a new “Task” to open all the Visual Studio commands dependencies

That “Developer Command Prompt” thing is a bare command prompt that runs a few bat files before you start using it. You just need to make it happen while opening a new console window on Cmder. To do it, open Cmder and hit Windows + Alt + T. You’ll see the Cmder Settings window on the Tasks section, like this:

Next, click the “+” button (highlighted above) and you’ll see some new fields appearing on the right side:

VSCommandLine2 stands for the name of the Task you’re creating. Keep this info as it will be very important on the next steps.

That second highlight with a buch of info is detailed below:

  • * (asterisk) is used to start this console as administrator, always;
  • /k is followed by the commands you’d like to run prior to the console opening. Here is the thing: we’re configuring it to run the Cmder init.bat — which is the script that makes everything more comfortable inside Cmder, adding colors, that lambda character to the console line, etc — followed by the VsDevCmd.bat, that sets everything up to interact with Visual Studio binaries inside the prompt.
  • -new_console is there to tell Cmder to open a new console with “C:\repos” as the initial directory (d:) and with “Developer Command Prompt” as the tab title (t:).

Let me be a good guy and share my parameters with you all:

*cmd.exe /k ""%ConEmuDir%\..\init.bat" & "<Your-VS-Tools-Folder>\VsDevCmd.bat"" -new_console:d:"C:\repos":t:"Developer Command Prompt"

Where my Your-VS-Tools-Folder is:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools

Save this new setting using the “Save settings” button.

2nd: Create the brand new Developer Command Prompt for Visual Studio shortcut

Now it’s time to make the magic happen. With caution, obviously. We’re going to find the VsDevCmd shortcut you already have; we’re going to back it up and then we’re going to create the new shortcut using the Cmder executable and the needed parameters.

Mine was located at:

%programdata%\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools

Find yours and it will open this folder. You’ll see something like this:

That bad guy is right there. Just hit Ctrl + C, Ctrl + V and boom:

Edit the properties of the original file (Developer Command Prompt for VS 2017) and change the “Target” property to:

“<your-cmder-path>\Cmder.exe” /TASK VSCommandLine2

See? That VsCommandLine2 I told you to save to use later. Here is the right time. This command line runs Cmder and tells it to run the VSCommandLine2 task after opening.

By the way, my <your-cmder-path> was:

C:\Program Files (x86)\Utils\cmder_mini

Save this shortcut file and try to open it. Voilá:

Good! Here we can see:

  1. Nice! The Visual Studio dependencies are all loaded just like the classic command prompt version did;
  2. That d: parameter on the Cmder Task we created worked! It started on C:\repos folder;
  3. Ah, that lambda character… So beautiful…
  4. Good, the tab has the name we set on the Task

Hope you enjoy! And if you still do not use Cmder… Just go be happy!