
[英]Trying to run a headless executable command through Powershell that works on cmd line
[英]Run CMD Command through PowerShell
我正在尝试在CMD中运行命令,但想通过PowerShell运行。
Invoke-Item
打开CMD,但是我不怎么传递program.exe argument > file.txt
要从PowerShell运行cmd.exe,不需要使用invoke-item,例如:
cmd /c c:\windows\system32\ipconfig > file.txt
但是,为什么不运行呢?
ipconfig > file.txt
尝试直接使用program.exe的完整路径限定符传递命令,例如:
$test= "c:\windows\system32\program.exe argument > file.txt"
Invoke-Expression $test
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.