user7836693
user7836693

Reputation: 25

function inside a loop - powershell

How do I call a function inside loop? I'm trying to run an infinite loop that will run a function(s). I have something like this

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


function filterFile{
   #do filtering of files here
}

function anotherFunction{
    #another function 
}

If it possible how can I achieve it, if not is there other way?

Upvotes: 2

Views: 3529

Answers (1)

Ranadip Dutta
Ranadip Dutta

Reputation: 9133

Quoting the "TheMadTechnician's" answer. Changing the order will do that:

function filterFile{
   #do filtering of files here
}

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

Upvotes: 2

Related Questions