Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
I want to automate a series of Windchills task that I would normally carry out interactively using the Windchill Shell.
The Windchill Shell command shortcut appears to be:
C:\ptc\Windchill\bin\windchill.exe -w "C:\ptc\Windchill" --java="C:\ptc\Java\jre\bin\java.exe" shell
But if I put this as the first line in the Windows Batch file, it spawns a sub-shell with the Windchill Environment and hence any later commands in the batch file do not run in it.
It seems as if I need to specify a further argument to the Windchill.exe command line to refer to the commands that I want to run but this does not seem to be possible.
Can anyone advise me how to achieve this?
Thanks in advance
Gary
Just found the search tool - nothing to see here...
Here is the answer:
A little off topic for this thread. But in Windows you just need to create
a bat file that starts with a line like;
call c:\ptc\windchill\bin\toolssetup.bat
OK - the toolssetup.bat file does not exist in Windchill 9.1
My question still stands...
Hi Gary,
I guess, using ANT scripts would be a better choice.
In Reply to Gary Mansell:
OK - the toolssetup.bat file does not exist in Windchill 9.1
My question still stands...
Praseeth,
Thanks for taking the time to respond, but writing an ant script seems like massive over kill when all I want to do is run some command line in a Windchill Shell environment - surely there must be a way to seed the Windchill Environment into a command tool shell?
Can anyone shed any light on this?
Rgds
Gary
Gary,
Here are some examples to get you started.
This one issues a stop command to the servers and shuts them down:
D:\ptc\Windchill\bin\windchill.exe -w "D:\ptc\Windchill" --java="D:\ptc\Java\jre\bin\java.exe" stop
This one issues a start command:
D:\ptc\Windchill\bin\windchill.exe -w "D:\ptc\Windchill" --java="D:\ptc\Java\jre\bin\java.exe" start
This one gets you a Windchill shell/command prompt:
D:\ptc\Windchill\bin\windchill.exe -w "D:\ptc\Windchill" --java="D:\ptc\Java\jre\bin\java.exe" shell
This one issues a load from file command:
D:\ptc\Windchill\bin\windchill.exe wt.load.LoadFromFile
Note that you can also add some switches to actually process the file, E.G:
D:\ptc\Windchill\bin\windchill.exe wt.load.LoadFromFile -u username -p password -m D:\ptc\Windchill\loadfiles\csvmapfile_mod.txt
Hope that helps,
-----
Lewis
In Reply to Gary Mansell:
I want to automate a series of Windchills task that I would normally carry out interactively using the Windchill Shell.
The Windchill Shell command shortcut appears to be:
C:\ptc\Windchill\bin\windchill.exe -w "C:\ptc\Windchill" --java="C:\ptc\Java\jre\bin\java.exe" shell
But if I put this as the first line in the Windows Batch file, it spawns a sub-shell with the Windchill Environment and hence any later commands in the batch file do not run in it.
It seems as if I need to specify a further argument to the Windchill.exe command line to refer to the commands that I want to run but this does not seem to be possible.
Can anyone advise me how to achieve this?
Thanks in advance
Gary
Gary,
There are some options depending on what you are trying to accomplish. I use all these approaches when they fit the situation.
You have to understand what the Windchill Shell command does and how it does it for the particular Windchill release(s) you use. Launch a Windchill shell from the command line in verbose mode. For example, from a Windows command shell:
windchill.exe -v shell
Note: Replace %WT_HOME% with the actual path to your Windchill home.
The previous command generates a long list of information and you have to figure out what it is really doing (e.g. setting WT_HOME, loading properties files, configuring the ANT environment, etc). In 9.1 I found it was really setting the current directory, some key environment variables like WT_HOME and JAVA_HOME and calling setvars.bat and tools.bat. So I added this to my batch files:
set JAVA_HOME=D:\ptc\Windchill_Apps\Java
pushd %WT_HOME%\bin\
call tools.bat
Matt,
You are a star - thanks very much, I do indeed want to schedule this batch file of Windchill Shell commands to run overnight.
I am running Windchill 9.1 and have tried doing exactly what you have detailed and have proved it works.
I can now schedule some out of hours work to be done whilst I am not in the office, thus saving me having to work out of hours !!
Many thanks
Gary