Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Command prompt UAC

Posted on 2007-03-23
5
Medium Priority
?
964 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 59

Accepted Solution

by:
LeeTutor earned 1500 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So who is this article for? If you are like most of the computer users out there, you probably only realize the meaning of 'System maintenance' after something goes wrong. This article is for you if you care about keeping your system working opti…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

670 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