Windchill tips : run windchill shell commands in batch mode

| 2 minutes read

This article is the first in a series of tips and tricks for Windchill. For those who don’t know what is Windchill yet : it is a PLM (Product Lifcycle Management) solution edited by PTC, and widely used in aerospace, defense and industry domains.

Our first tip proposes to run windchill shell commands within a batch. This can be very convenient when you need to run some treatment in the MS Windows schedule tasks.

At first glance, one might think that it could be done by simply calling your command like this (as provided in the windchill shell shortcut):

set WT_HOME=C:ptcWindchill_10.0Windchill
set JAVA_HOME=C:ptcWindchill_10.0Java

REM Run a windchill shell
%WT_HOME%binwindchill.exe -w %WT_HOME% –java=”%JAVA_HOME%binjava.exe” shell

REM Test a windchill shell command
call xconfmanager -p
pause

In fact, this call to windchill shell does not work because the batch stuck in the shell without executing the “xconfmanager” command. Then if you run “exit” you’ll see it will tries to execute the command without success.

Windchill-shell_Test3

To find a solution, back to basics: what is a windchill shell?

It is a standard shell console with some environment variables set in it (JAVA_HOME, WT_HOME, ANT_HOME, PATH, SQLPATH).
The OOTB (Out Of The Box) batch %WT_HOME%/bin/setvars.bat can set ANT_HOME, SQLPATH and PATH for you :

echo off
REM Set environment variables
set WT_HOME=C:ptcWindchill_10.0Windchill
set JAVA_HOME=C:ptcWindchill_10.0Java

REM go to the WT_HOME directory
cd /d %WT_HOME%

REM switch to the bin directory
pushd %WT_HOME%bin

REM set environment variables required for windchill shell
call setvars.bat

REM back to the %WT_HOME% directory
popd
REM Windchill shell is now created
echo on

REM Test a windchill shell command
call xconfmanager -p

pause

Then it will work and you will be able to schedule your batch during the night !

Windchill-shell_Test2

 

Julien Boulay Author: Julien Boulay

Eclectic developer & architect
Activist for usability, performance and interoperability of systems.

My favorite quote : "The best feature is the one we don't need to develop !"

My hashtags : #windchill #java #talend #nodejs #angularjs #oss #docker

Like it?  Share  it!

Share Button