my dog learned polymorphism*
The moose likes Java in General and the fly likes Windows : Running netsh command as an administrator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Windows : Running netsh command as an administrator" Watch "Windows : Running netsh command as an administrator" New topic
Author

Windows : Running netsh command as an administrator

akash mahakode
Greenhorn

Joined: Apr 30, 2007
Posts: 1
Hi Experts,

I want to run "netsh" command on windows 7 with some parameters. It requires administrator privileges. This can be achieved either by launching "cmd"as an administrator.
But I want run "netsh" command as Runtime.getRuntime.exec("cmd /c netsh"); with administrator privileges.

Please guide me to achieve this.

Thanks,
Akki
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

Instead of using cmd, use runas. Run runas /? to see the options.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Windows : Running netsh command as an administrator
 
Similar Threads
Error while compiling a program in Java using command prompt
Java socket connection does not work in Vista
Java GUI running batch(.bat) file in command line
jEdit! What is your classpath?
How to install a java jar on windows vista and 7