简体   繁体   中英

Pass Powershell parameter into batch file

I am trying to pass an environmental parameter from PowerShell into a batch file, so it calls the correct XML to use for deployment.

PowerShell Script:

$SelectedXMLServer = "$x.xml"
Start-Process "C:\DeployTools\Latest_Deployment.bat" $SelectedXMLServer

It still calls the batch file but doesn't pass the parameter in.

Batch File:

@echo off
CD /D "C:\Deployment\Install\DeployScripts"
echo Deployment will now start
cscript deploy.vbs ..\DeploymentXml\%Deploymentxml%.xml

If I simply change the batch file to 1 it worked

@echo off
CD /D "C:\Deployment\Install\DeployScripts"
echo Deployment will now start
cscript deploy.vbs ..\DeploymentXml\%l%.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM