Friday, August 31, 2007

Shortcut: Launch Visual Studio Command Prompt from Visual Studio

In Visual Studio 2005:

  1. Go to Tools > External tools
  2. Click Add and enter the following information
    1. Title: Cm&d
    2. Command:  %comspec%
    3. Arguments: /k ""C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"" x86
    4. Initial Directory: $(ItemDir)
  3. Click Apply / OK 

In Visual Studio 2008:

  1. Go to Tools > External tools
  2. Click Add and enter the following information
    1. Title: Cmd
    2. Command:  %comspec%
    3. Arguments: /k ""C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86
    4. Initial Directory: $(ItemDir)
  3. Click Apply / OK

Technorati tags: ,

17 comments:

  1. hi
    Recently i downloaded microsoft visual web developer 2008 express edition.it doesnt have visual studio command prompt i tried a shortcut way from your site.but i dont no how it works.can you tell me a step by step way to get a visual studio command prompt to compile my assembly files.
    thank you in advance

    ReplyDelete
  2. Kanna,
    Unfortunately I do not have Visual Studio Express on any of my machines. Can you tell me on which step you need more help?

    ReplyDelete
  3. hi arjun
    thanks for ur reply
    how this "shortcut: Launch Visual studio command prompt from visual studio" works.I did the steps u said in these comments for vs2008.but i dont know what i have to do next after completing these steps to get visual studio command prompt.
    is there any other way to get visual studio command prompt.since i have downloaded visual studio web developer 2008 express edition(http://www.microsoft.com/express/download/).it doesnt have visual studio command prompt.now i want to compile my assembly files.
    can u tell me the way to get visual studio command prompt to compile my assembly files.
    thanks in advance

    ReplyDelete
  4. Kanna,
    Once you complete the steps listed in the post, you should see a new menu item in the Tools menu. So click Tools > Cmd.
    This will open a new command prompt window, from where you can invoke the C# compiler.

    ReplyDelete
  5. hi arjun
    yeh its working.
    but i couldnt compile a assembly file.its saying "vbc is not recognized as an internal or external command,operable or a batch file.(the path is on my documents and then visual studio 2008 and in current website).and also i tried just ildasm its saying the same.
    thanks in advance

    ReplyDelete
  6. hi i also tried c# compiler
    thats csc command
    but its showing the same error(not recognized command,operable or a batch file)

    ReplyDelete
  7. hi arjun
    thanks for help.now only i noticed,u said its a shortcut so it wont create a new command prompt.in clear people who have visual studio command prompt can use ur code to have a shortcut.but here i have no vs command prompt in tools and all the supporting file.i dont think i can use normal command prompt as visual studio command prompt without having supporting files.so i have to buy.
    u did a nice job
    thanks

    ReplyDelete
  8. Kanna, I am glad I was able to help you out. Please keep reading.

    ReplyDelete
  9. Kanna, I dont know if this is exactly the same as what microsoft offically does with the other bat file, but one thing that works well is:

    set path=%path%;%windir%\Microsoft.NET\Framework\v3.5

    Add the above dir to your system path (you can also set this in Windows UI in Computer -> Manage).

    Any command window will be like a vs cmd, and you can run commands including csc and msbuild.

    ReplyDelete
  10. When I followed the directions for creating the external Cmd command at the start of this post, the CMD command's /K argument failed with an error message indicating that the batch file did not exist.

    In my case - I downloaded only Visual Basic .Net 2008 Express - there is no .bat file called 'vcvarsall.bat' in the /K argument's listed folder.

    The correct Cmd argument, at least for my case, should be:

    /k ""C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat""

    Paul

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete
  12. I just downloaded C# Express and wasn't sure how to access the Visual Studio command prompt. This posting helped me out. Thanks!

    ReplyDelete
  13. How to open the Visual Studio Command Prompt by using Run Tool n what is the Command?

    ReplyDelete
  14. svcutil.exe is not working with this shortcut .....can anyone tell me what to do? Thanks in advance.......

    ReplyDelete
  15. Hi, I am able to launch the command prompt window by specifying this command in a batch file
    "%comspec% /k ""C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86"
    On Calling the batch file, it open the path
    Read from Command prompt :
    C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE>

    The batch file is stored in my application. But it doesn't gets the application path. How do I do this. Please help me.

    ReplyDelete
  16. how to get a c command prompt on vb express 2008?

    ReplyDelete

Subscribe to my feed in your favorite feed reader