准备运行powershell脚本的环境
我需要安排一个 powershell 脚本,在执行此操作之前,我需要通过运行一些其他 powershell 脚本来准备环境。
基本上我想运行
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' "
第一个语句将破坏我的环境,然后我想执行我自己的脚本。
问题是,如果我使用 -noexit 命令,下一个脚本永远不会被执行。如果我使用 -command 而不是 -noexit,这些命令似乎在不同的 powershell 实例中执行,因此我的第二个脚本出错。
我是 powershell 的新手,我尽最大努力寻找答案。任何帮助都会非常感激。谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您自己没有解决这个问题,或者其他人需要语法,请执行以下操作:
If you didn't solve this on your own, or if anyone else needs the syntax, here you go: