I\'m trying to get a batch file to automatically enter the password into the \"runas\" program, but I can\'t get it to work. Here\'s my batch file so far:
ec
The Batch-JScript hybrid script below do what you want. Save it with .bat extension.
@if (@CodeSection == @Batch) @then
@echo off
start "" runas /user:testuser c:/path/to/my/program.exe
CScript //nologo //E:JScript "%~F0"
goto :EOF
@end
WScript.CreateObject("WScript.Shell").SendKeys("password{ENTER}");
For further details, see this post