Clarification about the CD thing....

Most batch files, if you run them, their "current working directory" will be the directory in which the batch file resides. It is also possible to change the current working directory of any batch file or program by making a shortcut and then changing the working directory in the properties of the shortcut.

Recently, Windows has had this thing called "UAC" which prevents programs from running as an administrator unless you tell it otherwise. So they added that advanced shortcut property setting I talked about, to allow you to create a shortcut that defaults to running as administrator. So far so good.

But one of my pet peeves is that they fucked it up. Now, when you create a shortcut that runs as administrator, it fucks up the working directory. No matter what you set for the working directory in the shortcut properties, the working directory always gets changed to the Windows System folder if you've ticked the "administrator" tickybox. It's been this way ever since Windows Vista I think.

So now everyone's batch files has to CD at the beginning of the batch file when they didn't need to before. I have no idea how something so egregious, something that immediately breaks everybody's batch files, didn't get repaired right away, and even persisted through four major OS releases. Sigh.

By the way, the secret trick that you can put at the top of all your batch files, which will always set the working directory to be the location of the batch file itself, is this:

Code:
setlocal enableextensions
cd /d "%~dp0"
_________________________
Tony Fabris