現在、以下はVMware vSphere PowerCLIコマンドプロンプトを起動するためのパスです。 sample.ps1
スクリプトをバッチファイルを使用して自動的に実行したいと思います。 sample.ps1
をこのパスに組み込み、バッチファイルを作成するにはどうすればよいですか?あなたはPowerShellの2.0を使用している場合バッチファイル(.bat)を使用した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セッションを維持します。彼が立ち上げたいスクリプト。 – JPBlanc
これは複製ではありません... http://stackoverflow.com/questions/6037146/how-to-execute-powershell-commands-from-a-batch-file – SteveC