Running a PS1 script using a batch file (.bat)

Question:

Currently the following is my path for launching the VMware vSphere PowerCLI command prompt. I wish to run my sample.ps1 script automatically using a batch file. How can I incoporate sample.ps1 into this path and create a batch file?

Answer:

If you are working with PowerShell 2.0, you can use the -file parameter of PowerShell.exe


If you are working with PowerShell 1.0, you can use -command parameter this way

Source:

Running a PS1 script using a batch file (.bat) by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply