Click here to Skip to main content
15,885,278 members
Articles / Batch
Alternative
Tip/Trick

Batch file caveat when running as administrator

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
1 Mar 2011CPOL 9.2K   3   3
First command of the file should be:PUSHD directory_you_want_to_be_inThat solves it always. No testing for anything. No need to error out, because your expected file's gonna be in the expected directory.
First command of the file should be:

PUSHD directory_you_want_to_be_in

That solves it always. No testing for anything. No need to error out, because your expected file's gonna be in the expected directory.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralPass the directory you're going into as a parameter to the s... Pin
Br.Bill1-Mar-11 8:50
Br.Bill1-Mar-11 8:50 
GeneralRe: I think the one above is better (I was talking about running... Pin
Indivara1-Mar-11 20:03
professionalIndivara1-Mar-11 20:03 
GeneralBut what if you don't know which directory you want to be in... Pin
Indivara1-Mar-11 0:51
professionalIndivara1-Mar-11 0:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.