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