繁体   English   中英

使用Powershell在后台运行功能

[英]Running a function in background with Powershell

我想在后台运行功能Get_List,并且在运行时,屏幕上应显示“正在搜索信息” +点,以使其看起来好像工作已完成。

function Get_List {
    #Some basic command to run in the background
}

function Other{
    #start the Get_List function in background

    while(Get-Job -State "Running")
    {
        #show "Searching for Information"
        #no need to code this part for me
    }
}

我见过很多人有类似的问题,但是我的(我认为)有些不同。 没有传递任何参数,我只想在后台运行一些操作,这大约需要5到10秒钟,完成后就可以了。

我正在尝试变得尽可能简单。 任何帮助表示赞赏。

一种简单的替代方法是使用Write-Progress来显示您的伪造或实际进度。 看看https://technet.microsoft.com/en-us/magazine/2008.03.powershell.aspx

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM