Monday, October 18, 2010

How to execute a batch from the current directory even when you run as admin

When you want a batch file to execute from the same directory that it's located and have to "Run as admin" you'll have a problem because it defaults to "%Windows%system32" instead of the current directory.

Add these two lines to the top of your batch file
@setlocal enableextensions
@cd /d "%~dp0

No comments:

Post a Comment

There was an error in this gadget