我有一个PowerShell脚本,我正在调试,并希望将所有写主机语句重定向到一个文件.有一个简单的方法吗?
我有一个脚本调用“ a.ps1”:
write-host "hello host"
"output object"
Run Code Online (Sandbox Code Playgroud)
我想调用脚本并获取输出对象,但我也希望取消标准输出:
$result = .\a.ps1
# Don't want anything printed to the console here
Run Code Online (Sandbox Code Playgroud)
有什么提示吗?
powershell ×2