get-content -Path C:\Users\user\AppData\Local\Temp\90\tmpDF49.tmp -wait
但是如果我打开run菜单(WINKEY+R),然后像这样运行它:
powershell -command 'get-content -Path C:\Users\user\AppData\Local\Temp\90\tmpDF49.tmp -wait'
我也在powershell脚本中尝试过同样的方法,它只是关闭了…就像运行菜单一样:
[Diagnostics.Process]::Start("powershell.exe", "-command `"get-content -Path $($tmpFile) -wait`"")
您需要从运行行运行以下操作:
powershell -NoExit -command "Get-Content -Path C:\Users\user\AppData\Local\Temp\90\tmpDF49.tmp -wait"
-command 开关设计为运行提供的命令并退出,除非 -NoExit 已指定。 -不退出 必须在 -命令 设计参数。
-command
-NoExit
-不退出
-命令
跑步 PowerShell.exe -Help
PowerShell.exe -Help