• Post Reply Bookmark Topic Watch Topic
  • New Topic

Windows : Running netsh command as an administrator

 
akash mahakode
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20831
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using cmd, use runas. Run runas /? to see the options.
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!