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
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
2nd cmd window
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
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
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
{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
how about bringing iexplore up instead, this doesn't work.
runas /user:%computername%administrator "c:windowssystem32cmd.exe /c iexplore.exe"
runas /user:%computername%administrator "c:windowssystem32cmd.exe /c iexplore.exe"