INvoking Run As in XP

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
IanSmith
Junior Coder
Posts: 24
Joined: Tue Jul 12, 2005 2:31 pm

INvoking Run As in XP

Post by IanSmith » Mon May 08, 2006 3:21 pm

Hello all,

Quick question; has anyone had any luck invoking Run As from a command line? I need to open a control panel applet (.cpl) with elevated privileges. I know that you cannot pass the password directly, and have to enter that into a dialogue box, but I'm looking for a way to start the journey without having to navigate through Explorer...

Any comments/suggestions/howls of derision would be appreciated.

Thanks, Ian

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon May 08, 2006 4:45 pm

I've never done this but if you open a command prompt and type in "runas /?", the explanation seems straightforward.

Assuming your OS is NT4.0 or later, try something like:

Run>cmd /c runas /user:administrator ProgramName


I assume that windows will then prompt you for the admin password.

Later,
Dick

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon May 08, 2006 5:20 pm

Its lunchtime so I thought I'd play around with this and it wasn't quite as straightforward as it first appeared.
This works for me:

Run>cmd /c runas /user:administrator notepad.exe
Wait>1
Send>supersecretadminpassword


Hope it works for you.
Dick

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts