Hug*_*ugo 3 c# powershell service
我目前正在尝试构建一个PowerShell脚本,需要将我自己的C#应用程序作为服务启动,然后我需要检查事件日志中的错误或其他条目.但是一旦完成了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 #>
Run Code Online (Sandbox Code Playgroud)
如何启动我的服务然后再运行另一个命令?
您可以使用Start-Process无需等待即可运行.
例:
Start-Process -FilePath 'dotnet' -WorkingDirectory 'C:\MyCSharpProject\Project' -ArgumentList 'run --debug'
notepad
Run Code Online (Sandbox Code Playgroud)