Windows 7 Forums


Windows 7: batch files - run as administrator

24 Apr 2010   #1

Windows 7 Pro
 
 
batch files - run as administrator

I am a software developer (dot net). Until recently I did all my work in the XP environment. I developed a utility library that goes into the global assembly cache. In the XP world this was easy.

I write some .bat files that called the gacutil.exe and passed it the appropriate parameters.

gacutil.exe is a command line app, so right-clicking in Explorer and selecting run as administrator does no good.

I use .bat files because the path to gacutil.exe is a mile long, and the path to the library to register is a mile long. Typing the paths by hand every time is very tedious and very error prone.

How can I run the utility with administrator privileges?

Thanks,
Jon

My System SpecsSystem Spec

24 Apr 2010   #2

Windows 7 Ultimate
Twelve feet from huge ass monitor.
 
 

Run from a cmd window launched as admin.

As for the long path... why not create an environment variable for the path, or "set path" ?
.

(Option Four) Run as Administrator
Attached Thumbnails
batch files - run as administrator-capture.png  
My System SpecsSystem Spec
24 Apr 2010   #3

Windows 7 x64 pro/ Windows 7 x86 Pro/ XP SP3 x86
 
 

You could use the "Runas" command at the beginning of your batch file. See this.

Command-line Argument for Admin Rights
My System SpecsSystem Spec
.


24 Apr 2010   #4

Windows 7 Pro
 
 

Great information from both of you!
Thank you very much.
Jon
My System SpecsSystem Spec
Reply

 batch files - run as administrator problems?



Thread Tools



Similar help and support threads for: batch files - run as administrator
Thread Forum
batch files Software
How to always run batch file as administrator? General Discussion
Solved Batch files and UAC System Security


All times are GMT -5. The time now is 11:03 AM.


Seven Forums Android App Seven Forums IOS App Follow us on Facebook

Windows 7 Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32