【发布时间】:2011-09-30 02:35:07
【问题描述】:
目前以下是我启动 VMware vSphere PowerCLI 命令提示符的路径。我希望使用批处理文件自动运行我的sample.ps1 脚本。如何将sample.ps1 加入此路径并创建批处理文件?
C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -psc "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -noe -c ". \"C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1\""
【问题讨论】:
-
你在问什么?您始终可以通过运行 powershell.exe 从 cmd 脚本调用 powershell 脚本,就像您在上面所做的那样。你还想做什么?
-
-psc = -PSConsoleFile -> 加载控制台文件以自动导入他的 SNAPIN。 -noe = -NoExit -> 为了保持 powershell 会话。然后是他要启动的脚本。
标签: powershell batch-file vmware virtual-machine powercli