Kudzu World

"البرمجة: فنّ و تمرّد"

Kudzu World  »  Blogspace  »  Kudzu's Tech Blog
English - Română - Русский - عربي

RSS Feed

If you want to more easily stay informed of updates etc you can subscribe to the RSS feed. Just point your RSS reader at this page, auto discovery is enabled.

Resetting current directory in bat files when running as adminstrator

2/21/2010

A batch file normally has its current directory set to the directory it resides in if executed from Explorer. However with Vista and Windows 7, the current directory is changed to the system directory when the "Run as Administrator" option is used. This creates a serious problem for many batch files.

Fortunately there is a simple solution. Add this line to the first line of your batch file:

cd %~dp0

<< Previous Entry    Next Entry >>

Comments:

-- No Comments --

Post a comment

Use my contact form to contact me directly.