循环中的函数 - powershell

时间:2017-05-30 23:04:36

标签: powershell

如何在循环内调用函数?我试图运行一个运行函数的无限循环。我有类似的东西

#Infinite loop to filter file
while ($true){
    #run this function
    filterFile
}


function filterFile{
   #do filtering of files here
}

function anotherFunction{
    #another function 
}

如果有可能我怎么能实现它,如果没有其他方式?

1 个答案:

答案 0 :(得分:1)

引用“TheMadTechnician's”的答案。更改订单会这样做:

function filterFile{
   #do filtering of files here
}

#Infinite loop to filter file
while ($true){
    #run this function
    filterFile
}