Right now, I'm trying to use a Powershell script to read through a textfile and execute all of the Powershell scripts mentioned in it, but I can't get any results. I've tried specifying it this way:
Start-Job -ScriptBlock{powershell.exe -noexit $val} -name $jobnum and this way: Start-Job -ScriptBlock{$val}
($val is the value of the line of text) but it doesn't run the script that's written on that line.
And I've tried this way: Start-Job -FilePath($val) -name $jobnum
But I get this error: Start-Job : Only PowerShell script files are allowed for FilePath parameter. Specify a file with .ps1 extension.
Even though the value of $val is a legitimate path to a file with ps1 extension!
My text lines look like this: C:\Users\me\Desktop\notepad.ps1
How do I get my Powershell script to read in text and run the ps1 scripts that have a path given in the text?