VMware Cloud Community
Muhammedali
Contributor
Contributor

using commandline parameters with .ps1 script file

In the maing bat file where i invoke powershell and powercli environment, can i send parameters to the .ps1 file

for eg

in my main.bat file i have:

set script_folder=%1

powershell.exe -psc "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -noe ". \"%script_folder%\PCLIScript_VMSetup.ps1""

______________________

now if i want to give the save variable script_folder as a parameter to the .ps1 file can i do as below:

powershell.exe -psc "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -noe ". \"%script_folder%\PCLIScript_VMSetup.ps1 "%script_folder"""

Reply
0 Kudos
0 Replies