Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single line command for Run as a different user on Windows 7 that contains a password also

Tags:

windows

cmd

Is there any single line command for Run As Different User in Windows 7.
I am using following command but then it ask for password

runas /user:USER-NAME "C:\full\path\of\Program.exe"

Is there any way to supply password also in above line ? Actually i am launching application from other application so I don't want any user interaction But in above command it ask user for PASSWORD

like image 931
USER_NAME Avatar asked Sep 17 '12 09:09

USER_NAME


People also ask

Can I pass the password to the runas command?

The runas command does not allow a password on its command line. This is by design (and also the reason you cannot pipe a password to it as input).

How do I Run a program as a different user?

Use Run As to start a program as another userLocate the program that you want to start in Windows Explorer, the Microsoft Management Console (MMC), or Control Panel. Press and hold down the SHIFT key while you right-click the .exe file or icon for the program, and then click Run as. Click The following user.


1 Answers

PsExec in the MS SysInternals suite:

psexec -user Administrator -p Passwd "xcopy a.xml \\server_over_there\c$\A.xml"
like image 195
mnemotronic Avatar answered Sep 27 '22 22:09

mnemotronic