Skip to main content
18-Opal
March 5, 2026
Solved

Running commands under Windchill Shell from a script

  • March 5, 2026
  • 3 replies
  • 186 views

Version: Windchill 13.0

 

Use Case: We have an Ant build script that builds and installs a PDMLink customization package. An engineer connects to a server via Remote Desktop and runs it from within Windchill Shell. We'd like to trigger it from a CD pipeline instead.


Description:

Hello All,

 

I've been using Windchill Shell interactively, i.e. launching `<WT_HOME>/bin/windchill shell` and then doing everything else in a session that opens. I can't figure out how to launch something (e.g., an Ant build script) under Windchill Shell in a "headless" mode, i.e. from a script (PowerShell, a batch file, a Bash script, ...) 

 

It sounds like a common problem and I'm sure people do it all the time, but... how?

 

Thanks,

Constantine

Best answer by rhart

I've never tried to script ant but used .bat for other windchill shell commands like xconfmanager, loadfiles, running cps installer.

 

I think ant would be similar, for example the ant command "ant -DHTTPS_ENABLED=true -f config.xml reconfigure" might look like this?

 

set "ANT_BIN=%WT_HOME%\ant\bin"

call "%ANT_BIN%\ant.bat" ^

 -DHTTPS_ENABLED=true ^

 -f config.xml reconfigure

 

@echo off
setlocal EnableExtensions EnableDelayedExpansion

REM ---- Configure Windchill home ----
set "WT_HOME=E:\ptc\Windchill_13.0\Windchill"
set "WC_BIN=%WT_HOME%\bin"

REM ---- Logging ----
set "LOG=%WT_HOME%\logs\windchill_shell_command.log"

echo.>>"%LOG%"
echo ==================================================>>"%LOG%"
echo %DATE% %TIME% - Starting windchill shell command >>"%LOG%"
echo WT_HOME=%WT_HOME%>>"%LOG%"
echo ==================================================>>"%LOG%"

REM ---- pre-requisite checks ----
if not exist "%WC_BIN%\setvars.bat" (
 echo ERROR: Missing "%WC_BIN%\setvars.bat"
 echo ERROR: Missing "%WC_BIN%\setvars.bat">>"%LOG%"
 exit /b 10
)

if not exist "%WC_BIN%\xconfmanager.bat" (
 echo ERROR: Missing "%WC_BIN%\xconfmanager.bat"
 echo ERROR: Missing "%WC_BIN%\xconfmanager.bat">>"%LOG%"
 exit /b 11
)

pushd "%WC_BIN%" || (
 echo ERROR: Cannot cd to "%WC_BIN%"
 echo ERROR: Cannot cd to "%WC_BIN%">>"%LOG%"
 exit /b 12
)

REM ---- Start the environment ----
call "%WC_BIN%\setvars.bat" >>"%LOG%" 2>&1
set "RC=%ERRORLEVEL%"
if not "%RC%"=="0" (
 echo ERROR: setvars.bat failed with exit code %RC%
 echo ERROR: setvars.bat failed with exit code %RC%>>"%LOG%"
 popd
 exit /b %RC%
)

REM ---- RUN WINDCHILL SHELL COMMANDS ----

echo Running: windchill shell command
echo Running: windchill shell command>>"%LOG%"

REM ---- Run an xconfmanager command
REM call "%WC_BIN%\xconfmanager.bat" -p >>"%LOG%" 2>&1
REM set "RC=%ERRORLEVEL%"

REM ---- Run a loadfile command like: windchill wt.load.util.CSV2XML -delimiter ~ -input test.csv ----
REM call "%WC_BIN%\windchill.exe" wt.load.util.CSV2XML ^
REM -delimiter ~ ^
REM -input "doc_migrations.csv" ^
REM >>"%LOG%" 2>&1
REM set "RC=%ERRORLEVEL%"

REM ---- Run a loadfile command like: windchill wt.load.LoadFromFile -d E:\ptc\Windchill_10.2\Windchill\src\loadFiles\test.xml -u wcadmin -p <pass> -CONT_PATH "/wt.inf.container.OrgContainer=<org>/wt.pdmlink.PDMLinkProduct=<product>"
call "%WC_BIN%\windchill.exe" wt.load.LoadFromFile ^
 -d "E:\ptc\Windchill_13.0\Windchill\src\loadFiles\doc_migrations.xml" ^
 -u wcadmin ^
 -p <pass> ^
 -CONT_PATH "/wt.inf.container.OrgContainer=<org>/wt.pdmlink.PDMLinkProduct=<product>" ^
 >>"%LOG%" 2>&1

set "RC=%ERRORLEVEL%"

REM ---- Run xconfmanager -p ----
REM call "%WC_BIN%\xconfmanager.bat" -p >>"%LOG%" 2>&1
REM set "RC=%ERRORLEVEL%"

REM set "WT_HOME=E:\ptc\Windchill_13.0\Windchill"
REM set "WC_BIN=%WT_HOME%\bin"

REM Optional log
REM set "LOG=%WT_HOME%\logs\cps_install.log"

REM ---- Run java
REM echo Running java safe area install... >>"%LOG%"
REM java -jar "%JAR%" --completeSafeAreaInstall "%WT_HOME%" >>"%LOG%" 2>&1
REM set "RC=%ERRORLEVEL%"

echo Running: windchill shell command done
echo Running: windchill shell command done>>"%LOG%"

popd

if not "%RC%"=="0" (
 echo ERROR: windchill shell command failed with exit code %RC%
 echo ERROR: windchill shell command failed with exit code %RC%>>"%LOG%"
 exit /b %RC%
)

echo Success: windchill shell command completed.
echo Success: windchill shell command completed.>>"%LOG%"
exit /b 0

 

3 replies

avillanueva
23-Emerald I
23-Emerald I
March 5, 2026

Not an expert but I think you need to have a runner installed on the Windchill server connected to Github. It can then be listening for requests to run your scripts.

rhart16-PearlAnswer
16-Pearl
March 9, 2026

I've never tried to script ant but used .bat for other windchill shell commands like xconfmanager, loadfiles, running cps installer.

 

I think ant would be similar, for example the ant command "ant -DHTTPS_ENABLED=true -f config.xml reconfigure" might look like this?

 

set "ANT_BIN=%WT_HOME%\ant\bin"

call "%ANT_BIN%\ant.bat" ^

 -DHTTPS_ENABLED=true ^

 -f config.xml reconfigure

 

@echo off
setlocal EnableExtensions EnableDelayedExpansion

REM ---- Configure Windchill home ----
set "WT_HOME=E:\ptc\Windchill_13.0\Windchill"
set "WC_BIN=%WT_HOME%\bin"

REM ---- Logging ----
set "LOG=%WT_HOME%\logs\windchill_shell_command.log"

echo.>>"%LOG%"
echo ==================================================>>"%LOG%"
echo %DATE% %TIME% - Starting windchill shell command >>"%LOG%"
echo WT_HOME=%WT_HOME%>>"%LOG%"
echo ==================================================>>"%LOG%"

REM ---- pre-requisite checks ----
if not exist "%WC_BIN%\setvars.bat" (
 echo ERROR: Missing "%WC_BIN%\setvars.bat"
 echo ERROR: Missing "%WC_BIN%\setvars.bat">>"%LOG%"
 exit /b 10
)

if not exist "%WC_BIN%\xconfmanager.bat" (
 echo ERROR: Missing "%WC_BIN%\xconfmanager.bat"
 echo ERROR: Missing "%WC_BIN%\xconfmanager.bat">>"%LOG%"
 exit /b 11
)

pushd "%WC_BIN%" || (
 echo ERROR: Cannot cd to "%WC_BIN%"
 echo ERROR: Cannot cd to "%WC_BIN%">>"%LOG%"
 exit /b 12
)

REM ---- Start the environment ----
call "%WC_BIN%\setvars.bat" >>"%LOG%" 2>&1
set "RC=%ERRORLEVEL%"
if not "%RC%"=="0" (
 echo ERROR: setvars.bat failed with exit code %RC%
 echo ERROR: setvars.bat failed with exit code %RC%>>"%LOG%"
 popd
 exit /b %RC%
)

REM ---- RUN WINDCHILL SHELL COMMANDS ----

echo Running: windchill shell command
echo Running: windchill shell command>>"%LOG%"

REM ---- Run an xconfmanager command
REM call "%WC_BIN%\xconfmanager.bat" -p >>"%LOG%" 2>&1
REM set "RC=%ERRORLEVEL%"

REM ---- Run a loadfile command like: windchill wt.load.util.CSV2XML -delimiter ~ -input test.csv ----
REM call "%WC_BIN%\windchill.exe" wt.load.util.CSV2XML ^
REM -delimiter ~ ^
REM -input "doc_migrations.csv" ^
REM >>"%LOG%" 2>&1
REM set "RC=%ERRORLEVEL%"

REM ---- Run a loadfile command like: windchill wt.load.LoadFromFile -d E:\ptc\Windchill_10.2\Windchill\src\loadFiles\test.xml -u wcadmin -p <pass> -CONT_PATH "/wt.inf.container.OrgContainer=<org>/wt.pdmlink.PDMLinkProduct=<product>"
call "%WC_BIN%\windchill.exe" wt.load.LoadFromFile ^
 -d "E:\ptc\Windchill_13.0\Windchill\src\loadFiles\doc_migrations.xml" ^
 -u wcadmin ^
 -p <pass> ^
 -CONT_PATH "/wt.inf.container.OrgContainer=<org>/wt.pdmlink.PDMLinkProduct=<product>" ^
 >>"%LOG%" 2>&1

set "RC=%ERRORLEVEL%"

REM ---- Run xconfmanager -p ----
REM call "%WC_BIN%\xconfmanager.bat" -p >>"%LOG%" 2>&1
REM set "RC=%ERRORLEVEL%"

REM set "WT_HOME=E:\ptc\Windchill_13.0\Windchill"
REM set "WC_BIN=%WT_HOME%\bin"

REM Optional log
REM set "LOG=%WT_HOME%\logs\cps_install.log"

REM ---- Run java
REM echo Running java safe area install... >>"%LOG%"
REM java -jar "%JAR%" --completeSafeAreaInstall "%WT_HOME%" >>"%LOG%" 2>&1
REM set "RC=%ERRORLEVEL%"

echo Running: windchill shell command done
echo Running: windchill shell command done>>"%LOG%"

popd

if not "%RC%"=="0" (
 echo ERROR: windchill shell command failed with exit code %RC%
 echo ERROR: windchill shell command failed with exit code %RC%>>"%LOG%"
 exit /b %RC%
)

echo Success: windchill shell command completed.
echo Success: windchill shell command completed.>>"%LOG%"
exit /b 0

 

18-Opal
March 12, 2026

Thanks @rhart , that's exactly what I was looking for!

 

So all I needed to do in my script was to set WT_HOME and call setvars.bat. It works! Demystifying windchill shell 😁

 

Regards,
Constantine

Community Manager
March 12, 2026

Hello @Constantine,

 

It looks like you have some responses from some community experts. If it helped you solve your question please mark the reply as the Accepted Solution. 
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.