Add Comment
|
Related Links
|
TrackBack
Running Batch File as Administrator vs. Running as UserMuch like executables, Windows can run batch scripts as either administrator or regular user. Running batch file as user is easy, all it takes is to double-click the batch file. To run the batch script as administrator, right-click on the batch file and click on the "Run as administrator" menu option. But Windows behaves differently when the batch script is running one way vs. another way. In this thread, we point out the subtle differences. Current Working Directory: When you run the batch file as a user, the working directory is where the batch file resides. But when you run the batch file as administrator, the current working directory is "%SystemDrive%\WINDOWS\system32". Because of this difference, when programming batch scripts, try not to rely on the current directory as the script location. Instead, determine the script location using batch variables. For example: set scriptDir=%~d0%~p0 Mel
Add Comment
|
Related Links
|
TrackBack
Did your message disappear? Read the Forums FAQ. Add CommentSpam Control | * indicates required field TrackBackTrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites. Send Ping | TrackBack URL | Spam Control No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here. Messages, files, and images copyright by respective owners. |
Products
|
Services
41 Users Online
|
Copyright © 1996 - 2024. All Rights Reserved. |