2014-09-29 75 views
1

我想要在电源shell中执行以下步骤: - 步骤1.)从power shell打开管理命令提示符。 步骤2)在步骤1中打开的管理命令提示符上执行一些命令。 步骤3)捕获步骤2中执行的命令的输出。 步骤4)关闭步骤1中打开的管理命令提示符。从powershell打开管理员命令提示符

经过很多谷歌和搜索,我无法找到实现上述任务所需的确切的电源shell命令。 请告诉上述是否可能,如果是的话那么怎么样?

回答

1

一种可能的方式(与命令代替echo测试)

$prog="cmd.exe" 
[email protected]("/C";"echo test";" >c:\temp\result.txt") 
Start-Process -Verb runas $prog $params 
gc c:\temp\result.txt 
相关问题