I need to make a batch file that detects what drive and directory it is in. When I run the the file normally, it is in the correct directory/drive already. But when it is run as admin, it starts in system32. Is there a command that goes to the directory or drive the batch came from?
Share
You could use
This changes the current directory to the path of the batch file.
Quoting the argument makes it safe against special characters in the pathname like “C:\Documents & Settings”