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:
$DirectoryList = Get-Content -Path C:\test foreach ($Directory in $DirectoryList) { Start-Process -FilePath powershell.exe -ArgumentList ('"{0}\How To Read Me.ps1" -Path "{1}"' -f $PSScriptRoot, $Directory); }