Changing the default Visual Studio Command Prompt Location

How to set the default Visual Studio command line location so that I can go directly to the project directory instead of the usual navigation.

+7
source share
7 answers

Add it as an external tool for Visual Studio (2008 shown here should be similar in other versions):

  • Select "Tools", "External Tools ...".
  • Click Add
  • Title: & Cmd
  • Command: cmd.exe
  • Arguments: / k "c: \ Program Files (x86) \ Microsoft Visual Studio 9.0 \ VC \ vcvarsall.bat" x86
  • Start Directory: $ (SolutionDir)

enter image description here

Pay attention to the arguments in the Visual Studio 2008 Command Prompt shortcut. Yours may be different.

You can customize the toolbar and add a button for this command, using also "Tools", "Customize ...". Open the Tools menu and find the last created external tool and drag it to the toolbar.

When you click the button, it will open a command prompt in the root directory of the current solution.

+8
source

In Visual Studio 2013 ,

Right-click the link " Developer Command Line for VS2013 " (which you can find in the "Common7 \ Tools \ Shortcuts" folder where you installed VS2013) and select " Properties ",

Change the " Start at: " directory to the desired location.

+6
source

For the Visual Studio 2017 command line, you need to set the environment variable VSCMD_START_DIR to the directory in which you want to exit after initializing the command line.

I am using this script:

set VSCMD_START_DIR=%1 "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"

It takes a directory as the first (and only) argument.

+4
source

You can put these lines in a batch script (vcvar.bat) located in the directory you want to start with:

 @echo off set VCDIR=%ProgramFiles%\Microsoft Visual Studio 10.0\VC if not exist "%VCDIR%" set VCDIR=%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\VC call "%VCDIR%\bin\vcvars32.bat" 

Run the command line command in this directory and call vcvar.bat . You now have a VS environment on the command line.

+2
source

Go to the file "vcvarsall.bat". For me the way:

 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat 

Add this line to the end of the script:

 cd /d "D:\WhereverYouWant" 

chipped

+2
source

this will add a “my compiler” menu item to each directory, giving you access to the command line in the directory. save it as something.reg

 Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\My Compiler] [HKEY_CLASSES_ROOT\Directory\shell\My Compiler\command] @="cmd.exe /k \"C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\vcvarsall.bat\"" 
+1
source
  • Copy the Windows shell from "C: \ Windows \ System32 \ cmd.exe" and paste it into "C: \ Your \ Project \ Directory \ cmd.exe"
  • Change the Visual Studio command line shortcut by replacing% comspec% with "C: \ Your \ Project \ Directory \ cmd.exe" in the Target field.

So, the Target shortcut should look something like this: "C: \ Your \ Project \ Directory \ cmd.exe" / k "C: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ VC \ vcvarsall.bat" "amd64

0
source

All Articles