Where to put batch file in Windows so that it is always accessible, without changing the PATH?

eudoxos picture eudoxos · Jan 31, 2014 · Viewed 7.1k times · Source

I have a NSIS installer for a program and change PATH settings to make the program always accessible from the command-line. Manipulating the PATH has however some adverse effect, such as other programs picking up DLLs from that directory.

In order ot avoid fiddling with PATH, I would like to create a wrapper .bat file calling the executable. Where should I put this .bat file so that it is always found? Is c:\Windows\System32 (more precisely, $SYSDIR in NSIS) appropriate in terms of good practices?

I am targetting 64bit systems, XP and Seven.

Answer

Anders picture Anders · Feb 2, 2014

I'm personally not a big fan of apps that do anything with my %path%, people that work with command line tools probably know how to change %path% or use doskey (alias).

If you want to use a batch file you should be able to get away with a one-liner like @"c:\path\to\my\app.exe" %* but a batch file wrapper like this makes the Ctrl+C handling very annoying.

Putting it in $windir should make it work with both x86 and x64 shells without having to worry about filesystem redirection...