Run All PowerShell Scripts In A Directory

Question:

I have a series of ps1 files in a directory, all of which have different names. I am trying to run them one after another with Start-Process and the -Wait parameter. How does loop through all the files in a directory and run one PowerShell script after another? There are no subfolders, and no files that are not of type ps1.

Here is my start:

Answer:

You could simply use the call operator (&):

Source:

Run All PowerShell Scripts In A Directory by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply