I needed to schedule a powershell script and before doing it, i needed to prep the environment by running some other powershell script.
Basically i wanted to run
PowerShell.exe -noexit " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\sharepoint.ps1' "
PowerShell.exe -command " & ' E:\PerfCounters\Powershell\RunPerf.ps1' "
The first statement will perp my environment and i want to execute my own script after that.
Issue is, if i use the -noexit command, the next script never gets executed. If i use -command instead of -noexit, the commands seems to be executed in different powershell instances so my second script is erroring out.
I am a newbee in powershell and i did my best tring to find a answer.开发者_开发技巧 Any help here would be really appreciated. thanks!
If you didn't solve this on your own, or if anyone else needs the syntax, here you go:
powershell -noprofile -command "& { & .\x.ps1; & .\z.ps1 }"
精彩评论