Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to run vcvars32.bat every time I start a cmd?

I'm using cl in cmd and having to run vcvars32.bat every time I open a cmd window is really a pain in the axx. Can anyone offer a way of running it automatically?

like image 507
Tengyu Liu Avatar asked Jul 17 '13 00:07

Tengyu Liu


1 Answers

From cmd /?:

If /D was NOT specified on the command line, then when CMD.EXE starts, it looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if either or both are present, they are executed first.

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun

    and/or

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

You therefore could add vcvars32.bat to one of those AutoRun registry values to have it executed for every cmd.exe instance (except when /D is explicitly specified, of course).

However, be forewarned that doing this could result in other weird side-effects (for example, it could cause other .bat/.cmd scripts to be run in an environment that they aren't expecting).

like image 117
jamesdlin Avatar answered Oct 23 '22 14:10

jamesdlin