Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerShell Not Returning to command line after running "dotnet run ..."

I'm currently trying to build a PowerShell script that need to start my own C# application as Service and then after I need to check back the event log for error or other entry. But as soon as the dotnet run task is done, the process won't let me run another command, it seam to wait for the started process to stop.

Here a example of PowerShell script

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 #>

How can I start my service and then run another command?

like image 654
Hugo Avatar asked Aug 10 '16 15:08

Hugo


1 Answers

You can use Start-Process to run something without waiting.

Example:

Start-Process -FilePath 'dotnet' -WorkingDirectory 'C:\MyCSharpProject\Project' -ArgumentList 'run --debug'
notepad
like image 146
Patrick Meinecke Avatar answered Oct 08 '22 22:10

Patrick Meinecke