Solved

Command prompt UAC

Posted on 2007-03-23
5
949 Views
Last Modified: 2012-06-21
I'd like to run a command in my batch file as an Administrator.

If this was linux, I'd have su -c ... or sudo to prompt me for a password to run as root. In Windows, I'm happy with the UAC dialogue, but how to make it happen in my .cmd file to elevate the privileges for that command only.

It doesn't seem right to have to run the entire batch file as administrator, by right-clicking etc.

[For what it's worth, the command is regasm, which quite rightly needs admin privileges.]
0
Comment
Question by:rstaveley
  • 3
5 Comments
 
LVL 59

Accepted Solution

by:
LeeTutor earned 500 total points
ID: 18780593
0
 
LVL 70

Expert Comment

by:KCTS
ID: 18780688
You could open a command window as administrator
Click on Vista Start button
Click on Run
Type in CMD [Enter]
You should see “This task will be created with administrative privileges”
Click on OK or press [Enter]
0
 
LVL 17

Author Comment

by:rstaveley
ID: 18780785
Just tried the manifest approach with no joy.

All of the other mechanisms involve elevanting the privileges for the entire batch file.
0
 
LVL 17

Author Comment

by:rstaveley
ID: 18780793
> elevanting

elevating
0
 
LVL 17

Author Comment

by:rstaveley
ID: 18801122
I guess not.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

The Service applet starts in Extended Mode by Default, with a taskpad on the left of the services pane. This view mode was introduced in XP. As I find it not very usefull, I like to use the Standard view as default, and without the Console tree. …
There are many reasons a PC runs slower than when it was new, ranging from malicious software intended to mess things up to simple general Windows use.  Your PC performance may slowly degrade over time without you noticing but when you buy a PC from…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now