PowerShell 中“nohup"的等价物是什么? [英] What is the equivalent of 'nohup' in PowerShell?

查看:143
本文介绍了PowerShell 中“nohup"的等价物是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 PowerShell 中模拟 unix 命令 nohup 的行为?那就是 nohup my-other-nonblocking-command.我注意到了 Start-Job 命令,但是语法对我来说有点不清楚.

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

此输出失败:

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

试试这个:

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

这篇关于PowerShell 中“nohup"的等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆