Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent of 'nohup' in PowerShell?

How can I emulate the behavior of the unix command nohup in PowerShell? That is nohup my-other-nonblocking-command. I have noticed the Start-Job command, however the syntax is somewhat unclear to me.

like image 776
Joannes Vermorel Avatar asked Oct 11 '13 15:10

Joannes Vermorel


1 Answers

> Start-Job my.exe

Fails with this output:

Start-Job : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Start-Job my.exe
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Start-Job], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.StartJobCommand

Try this instead:

> Start-Job { & C:\Full\Path\To\my.exe }

It will work, and you will see output like this:

Id     Name            PSJobTypeName   State         HasMoreData     Location             Command
--     ----            -------------   -----         -----------     --------             -------
2      Job2            BackgroundJob   Running       True            localhost             & .\my.exe

I hope that is what you're looking for because your question is a bit vague.

like image 115
petrsnd Avatar answered Sep 19 '22 02:09

petrsnd