Using Command Prompt arguments to run a file (with arguments) as an administrator?

1

1

I am making the menu items called Lock for Microsoft's BitLocker. I've got it all right up to one point: locking HDD partitions requires administrator privileges.
How do I use process paths or CMD or something similar to start an application elevated, with arguments?

Vercas

Posted 2010-12-07T14:30:08.567

Reputation: 532

Answers

0

You need the Elevation Powertoy for Vista. It also works on Windows 7. http://blogs.technet.com/b/deploymentguys/archive/2009/01/21/the-elevation-powertoys-and-windows-7.aspx

surfasb

Posted 2010-12-07T14:30:08.567

Reputation: 21 453

2

Use the RUNAS command and put your application name and its arguments within double quotes.

RUNAS /user:machinename\administrator "app arg1 arg2 \"filename with spaces\""

Paused until further notice.

Posted 2010-12-07T14:30:08.567

Reputation: 86 075

The RUNAS command will execute C:\Windows\system32\runas.exe with the given arguments. That application does not require administrator rights and it doesn't work, because I have tried. Anyway, I will try again, but do I need to specify the user? I mean... Can you show me a working example of executing notepad with administrator rights? – Vercas – 2010-12-09T17:56:48.857

@Vercas: runas /user:administrator notepad works for me. I can type some text and save the file in a protected directory. – Paused until further notice. – 2010-12-09T18:51:12.100

It asks me for my password and it does nothing after I type it. – Vercas – 2010-12-09T19:43:56.743