简体   繁体   中英

How can I force a .bat file to be launched and run using a .Net command prompt

If you double click on a .bat file, windows will run it in a command prompt.

I want a specific .bat file to be launched using the .Net command prompt as it uses gacutil.

How can I achieve this?

thanks!

If you put this line at the top of your bat file, it will set the environment variables for the visual studio command prompt

"C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"

You may need to adjust for your version of VS and if you're on a 64bit machine.

The compilers can be used from command line (or makefiles) just like any other compilers. The main things you need to take care of are the INCLUDE and LIB environment variables, and PATH. If you're running from cmd.exe, you can just run this .bat to set the environment:

C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat

follow these links for more information: Using Visual Studio's 'cl' from a normal command line

How to create a Batch File for Visual Studio Command Prompt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM