how to make a bat file to run as

February 10, 2011 at 03:28:37
Specs: Windows XP
I two accounts, one a normal user and one an admin. I want to creat a bat file that does this
runas /user:D\User01 cmd

This will work in both cmd or run but when I make the bat file it has a black cmd screen up

See More: how to make a bat file to run as

Report •

February 10, 2011 at 05:54:52
What is "D:\User01"?

runas/user:User01 cmd.exe

Happy is ONE who says I am an OttoMAN.

Report •

February 17, 2011 at 22:01:10

runas /user:Domain\Username cmd

Report •

February 17, 2011 at 23:07:59
it should there anything else in the batch file ?

create a batch file with below code, it should work..

@echo off
echo Set ws = CreateObject("WScript.Shell") >%temp%\123.vbs
start runas.exe /user:username "cmd.exe"
echo wscript.sleep 2000 >>%temp%\123.vbs
echo ws.SendKeys "password">>%temp%\123.vbs
echo ws.SendKeys "{ENTER}" >>%temp%\123.vbs
cscript /nologo %temp%\123.vbs

Subhash Chandra.

Report •
Related Solutions

Ask Question