从powershell打开pipe理员命令提示符

我想要在Power Shell中执行以下步骤: – 步骤1)从Power Shell打开pipe理命令提示符。 步骤2)对在步骤1中打开的pipe理命令提示符执行一些命令。步骤3)捕获在步骤2中执行的命令的输出。步骤4)closures在步骤1中打开的pipe理命令提示符。

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

一种可能的方法(用您的命令替换回声测试)

$prog="cmd.exe" $params=@("/C";"echo test";" >c:\temp\result.txt") Start-Process -Verb runas $prog $params gc c:\temp\result.txt