PowerShell运行后不返回命令行" dotnet run ..."

时间:2016-08-10 15:42:28

标签: c# powershell service

我目前正在尝试构建一个需要将自己的C#应用​​程序作为服务启动的PowerShell脚本,然后我需要检查事件日志中的错误或其他条目。但是一旦完成了dotnet运行任务,该进程就不会让我运行另一个命令,它会等待启动进程停止。

这是PowerShell脚本的一个示例

CD C:\MyCSharpProject\Project\ 
dotnet run --debug <# script stop after this command is run, and the next command is not run r#>
notepad <# This line is never hit #>

如何启动我的服务然后再运行另一个命令?

1 个答案:

答案 0 :(得分:5)

您可以使用Start-Process无需等待即可运行。

示例:

Start-Process -FilePath 'dotnet' -WorkingDirectory 'C:\MyCSharpProject\Project' -ArgumentList 'run --debug'
notepad
相关问题