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