How to Run Windows Batch Script as Administrator by Default?
I have a batch script that needs to execute as administrator. Using "Run as administrator" using the in the pop-up menu works, but the batch file is meant for drag-and-dropping folder onto. When a folder is dropped onto it, it is executed, but without the administrator privilege. Is there a way to make it execute as administrator?
Here is a partial work-around that works in "some" cases, but not others...
1. Create a Windows shortcut for the batch script.
Now your script will always execute with as administrator. For your purpose, this trick will work for anything you drag-and-drop onto it, where the object path does not include a space. But if your object path contains one or more spaces, the operation will fail. This problem seems to be a bug at the Windows OS level, so you can't fix it in your script. The problem issue never gets to your script.
Good luck. Let us know if this trick works for you.
Did your message disappear? Read the Forums FAQ.
Spam Control | * indicates required field
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.
16 Users Online
Copyright © 1996 - 2017. All Rights Reserved.