簡體   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