Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My customers don't want to do a SHIFT+Right Click > "Run as" on a script.

So I am looking for a way to do exactly the same from a batch script.

How to open this window on Windows XP from a batch script?

Run as windows XP

The user needs to launch the program as another local user.

EDIT

I found a solution for Windows 7 here but it doesnt' work on XP...

share|improve this question
    
ShellRunas could be a solution but I am astonished this feature doesn't exist on XP... –  Maxbester Jun 7 '13 at 12:28

1 Answer 1

CredTask.vbs:

On Error Resume Next

strComputer = "." 'local computer
strUserName = "Domain\User" 'user name
strPassword = "Password" 'user password

strCommandLine="calc.exe"

Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objServices = objSWbemLocator.ConnectServer(strComputer, "root\CIMV2", strUserName, strPassword, Null, Null, 0)

If Err.Number <> 0 Then
    WScript.Echo Err.Number & ": " & Err.Description
    WScript.Quit
End If

Set objClass = objServices.Get("Win32_Process")
Res = objClass.Create(strCommandLine, Null, Null, PID)
If Res <> 0 Then
    WScript.Echo "Error ru application code: " & Res
End If

Encode a Script

GreyMagic Online Script Decoder

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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