I need to run a PowerShell command in windows PowerShell, its running fine as expected. The problem is when I close the Windows PowerShell terminal, it kills the process, whereas I want the process to continue running forever.
Is there a way to close the terminal and have process working in the background.
Here is my command that I need to run:
.\start.ps1 -accountUuid '{XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX}' `
-repositoryUuid '{XXXXXX-XXXXX-XXXX-XXXX-XXXXXXXXXX}' `
-runnerUuid '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX}' `
-OAuthClientId XXXXXXXXXXXXXXXXX `
-OAuthClientSecret XXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXX `
-workingDirectory '..\temp'
You can try with the command Start-process
with option -NoNewWindow
to run the process in the background. Add all your arguments in -ArgumentList
.
Start-Process -FilePath ".\start.ps1" -ArgumentList "-accountUuid ...", "-repositoryUuid ..." -NoNewWindow
More info here