Now I am trying to use a Powershell script to read a text file and execute all the Powershell scripts mentioned in it, but I cannot get any results. I tried to specify it like this:
Start-Job -ScriptBlock{powershell.exe -noexit $val} -name $jobnum
and as follows:
Start-Job -ScriptBlock{$val}
( $valis the value of a line of text) but it does not run the script that is written on this line.
And I tried like this:
Start-Job -FilePath($val) -name $jobnum
But I get this error:
Start-Job: Only PowerShell script files are allowed for the parameter FilePath. Specify a file with the extension .ps1.
Despite the fact that the value $valis a legitimate path to a file with the extension ps1!
My text lines look like this: C:\Users\me\Desktop\notepad.ps1
Powershell script ps1, , ?