Page 1 of 1

2nd cmd window

Posted: Thu Apr 23, 2009 6:10 am
by dvendt
I want to run the command "control powercfg.cpl" after I perform a runas. The problem is a 2nd cmd window is created and I don't know how to insert this command in there using a batch file. I added the pause, but not needed.
Here is what I have:

for /f %%i in ('hostname') do set local=%%irunas /user:%local%administrator c:windowssystem32cmd.exe pausecontrol powercfg.cpl

2nd cmd window

Posted: Thu Apr 23, 2009 6:10 am
by dvendt
I want to run the command "control powercfg.cpl" after I perform a runas. The problem is a 2nd cmd window is created and I don't know how to insert this command in there using a batch file. I added the pause, but not needed.
Here is what I have:

for /f %%i in ('hostname') do set local=%%irunas /user:%local%administrator c:windowssystem32cmd.exe pausecontrol powercfg.cpl

2nd cmd window

Posted: Thu Apr 23, 2009 6:47 am
by jvierra
Dio it this way. The method you are using will not work as expected at all time and may give unstable results.
{code]
runas /user:%computername%MyAdmin "c:windowssystem32cmd.exe /c powercfg.cpl"[/code]


I am assuming you are trying to run the powerpanel in a command window started with alt credentials.
jvierra2009-04-23 13:50:47

2nd cmd window

Posted: Wed May 20, 2009 3:12 am
by dvendt
how about bringing iexplore up instead, this doesn't work.

runas /user:%computername%administrator "c:windowssystem32cmd.exe /c iexplore.exe"