Cynosure.X International LLC

:

Add Comment | Related Links | TrackBack
Related Content

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?

JJ
Wed, 03 Dec 2014 21:31:39 +0300

Here is a partial work-around that works in "some" cases, but not others...

1. Create a Windows shortcut for the batch script.
2. Right click on the shortcut.
3. Click on the "Properties" menu option.
4. Click on the "Advanced..." button.
5. Enable "Run as administrator" (see screen shot below).
6. Click on the "OK" button in the advanced properties dialog.
7. Click on the "OK" button in the properties dialog.

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.

Attached Image:

Advanced Properties.png

Seth
Sat, 06 Dec 2014 05:55:22 +0300

Add Comment | Related Links | TrackBack
Related Content

Did your message disappear? Read the Forums FAQ.

Add Comment

Spam Control | * indicates required field
Your Name: *
E-mail:
Remember Me!
Comment: *
File attachment is optional. Please do not attach a file to your submission unless it is relevent.
Attach File:
(20 MB Max)
Spam Protection: * Answer of 0 + 10?
Click button only once, please!

TrackBack

TrackBack 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
Forums | Latest | RSS
Library | Search | Wiki
Help | Licenses

Login | Register

60 Users Online

Hacking Digital Cameras
Fun for Photographers


Get Our

Memecoins!



Amazon Associate

Copyright © 1996 - 2024. All Rights Reserved.