Wednesday, August 27, 2014

windows - Runas different user to launch CMD and run command

I want to run a batch file as a different user, via the Windows -> Run dialogue.


I have tried:


runas /profile /user:test CMD "C:\Users\MyName\Desktop\Run.bat"
runas /profile /user:test "CMD "C:\Users\MyName\Desktop\Run.bat""
runas /profile /user:test "CMD \"C:\Users\MyName\Desktop\Run.bat\""
runas /profile /user:test "CMD \"C:\Users\MyName\Desktop\Run.bat"\"

but still no luck. It opens up CMD and asks me for my password. I enter it, and it opens another CMD window using the other username, but it doesn't run the bat. Instead, the title bar just says



Administrator: cmd "C:\Users\MyName\Desktop\Run.bat" (running as Home-PC\test)



Can anyone please help?

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...