Today I need to include in a PSADT deployment a .bat script with parameters… The bellow commandline works in a cmd:
call C:\TCINSTALL\Teamcenter\Tc188.8.131.52_wntx64\wntx64\tem.bat -jre "C:\BCTSI\custom\java\jdk11" -s "C:\Users\Test\Desktop\1 Script\Files\silent.xml"
But I can’t find the right format with PSADT. Maybe I need to add “” for to the java path? Do you see any wrong things here? I don’t have errors in logs but just nothing running…
Execute-Process -Path 'C:\Windows\System32\cmd.exe' -Parameters "C:\TCINSTALL\Teamcenter\Tc184.108.40.206_wntx64\wntx64\tem.bat -jre $jrefolder -s $dirFiles\silent.xml"
I would try escaping the double-quotes with a back-tick like this:
Execute-Process -Path 'C:\Windows\System32\cmd.exe' -Parameters "C:\TCINSTALL\Teamcenter\Tc220.127.116.11_wntx64\wntx64\tem.bat -jre `"$jrefolder`" -s `"$dirFiles\silent.xml`""
Thanks for the idea, we must be getting close to the goal, because the command in the log file looks almost like the cmd command but still nothing happens.
Alright I found it, I missed /c “Carries out the command specified by string and then stops.”, source: cmd | Microsoft Learn
Execute-Process -Path "C:\Windows\System32\cmd.exe" -Parameters "/c C:\TCINSTALL\Teamcenter\Tc18.104.22.168_wntx64\wntx64\tem.bat -jre `"$jrefolder`" -s `"$dirFiles\silent.xml`""
So basically to run a bat script inside PSADT:
Execute-Process -Path "$envSystem32Directory\cmd.exe" -Parameters "/c $dirFiles\BATSCRIPT.bat -otherparams"
In case of paramters with path must be inside quotes, add `" and good
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.