2

Ive got a java app which needs to execute a driver installer exe file. On Linux we type "gksudo myCommand". Is there a way to elevate permissions from Windows command line?

3 Answers 3

1

You may run every application in windows with a different user e.g. Administrator. But the user who executes this command needs to have the credentials to do so.

Edit.:

In advance you can lookup the User Account Control (UAC) which is available in Windows 7 and Vista if it is possibly an alternative for you.

3
  • what about the UAC popup that says something like... this app is requesting permissions... How do I invoke that?
    – AdamOutler
    Jul 4, 2011 at 6:06
  • There must be a better way.... I could always request that the user type their password with runas /user:administrator /savecred my command... then just pipe their answer into my stdin
    – AdamOutler
    Jul 4, 2011 at 6:09
  • The thing is you are doing the same things in linux aswell gksudo or plain sudo is nothing else than running a command as different user with superuser rights(in the case of linux as root). I edited my post and added the UAC to it.
    – fyr
    Jul 4, 2011 at 6:14
1

I decided to deploy an executable binary onto the system which calls the jar. This way the user can right click and run as administrator... That didn't work... SO I kept looking... Check this out..

Elevate.exe.. It's basically like Windows GKSudo!!!! http://www.robotronic.de/elevate.html

So... I packaged the 32bit exe into my program and deploy it, then run it as necessary.

0

You can use runas command like runas /user:Administrator myCommand (it requires the users to type password).

You can also use Start-Process cmdlet like Start-Process -Verb runas myCommand in PowerShell (it requires the users to click the UAC dialog).

see: http://satob.hatenablog.com/entry/2017/06/17/013217

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.