Run Background Jobs on Windows

Remote jobs are windows' version of screen.


Create a Job

Create a job and explicitly set the working directory. This will be given a default name and job id.

Start-Job -ScriptBlock {
    Set-Location "D:\path\to\your\project"
    python .\test.py
}

To create a job with a customized name:

Start-Job -Name "myjob" -ScriptBlock {
    Set-Location "D:\path\to\your\project"
    python .\test.py
}

View Job Status

View all jobs:

Get-Job

View a specific job by name:

Get-Job -Name "myjob"

View a specific job by ID:

Get-Job -Id <job_id>

Get Job Output

Receive-Job -Name "myjob" -Keep

or

Receive-Job -Id <job_id> -Keep

Stop a Job

Stop-Job -Name "myjob"

or

Stop-Job -Id <job_id>

Delete a Job

Remove-Job -Name "myjob"
Remove-Job -Id <job_id>