cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Use a Script to determine Creo 2 and 3 datecode?

acaldwell
3-Visitor

Use a Script to determine Creo 2 and 3 datecode?

Working on a new startup script and we have users on various datecodes of Creo 2 and 3.  I need to find a way to obtain the buildcode they are using and populate that into a variable for a script.

This was done previously in Creo 1 and earlier versions via the below;

REM find the version of Creo

for /F "tokens=2 usebackq" %%A IN (`findstr "SHIPCODE" %proload%\uninstall\instlog.txt`)DO set CREO_VER=%%A

for /F "useback tokens=*" %%a IN ('%creo_ver%') DO set creo_ver=%%~a

But with Creo 2 and beyond this method no longer works.  Anyone have a work around or solution they've implemented in the past?


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
1 ACCEPTED SOLUTION

Accepted Solutions

SET CREODIR=C:\PTC\Creo 3.0

for /f %%G in ('dir "%creodir%" /B /A:D') DO SET LASTBUILD=%%G

View solution in original post

4 REPLIES 4

SET CREODIR=C:\PTC\Creo 3.0

for /f %%G in ('dir "%creodir%" /B /A:D') DO SET LASTBUILD=%%G

KevinBrault
4-Participant
(To:jgrossett)

Here is another option. I use this to grab several variables from both the local install and master site and notify the user if they are out of date.

for /f "tokens=2,6,9,11,13,15 usebackq" %%a in (`findstr "<PRODUCT" "%InstallSource%\Creo_%CreoVersion%\Installer_App_Win%WinVer%\pim\xml\creobase.xml"`) do (

  if not "%%a"=="" set %%a

  if not "%%b"=="" set %%b

  if not "%%c"=="" set %%c

  if not "%%d"=="" set %%d

  if not "%%e"=="" set %%e

  if not "%%f"=="" set %%f

)

You'll end up with several environment variables set (e.g. "datecode").

Thanks this works perfectly for Creo 3, I modified just a bit for Creo 2 and it's great!!

This syntax originally came from Olaf Corten, It works for me so I haven't mucked with it.

For Creo 3 I have this in my startup script.

set CREO3PATH=C:\PTC\Creo 3.0

** REM Check and set current build

set CREOVERSION=Unknown

** REM CREOVERSION will be set to the alphabetical latest folder

FOR /F %%i IN ('dir /AD /B /ON "%CREO3PATH%\F*" "%CREO3PATH%\M*"') DO (set CREOVERSION=%%i)

** REM Error message if no build folder has been found

IF NOT EXIST "%CREO3PATH%\%CREOVERSION%\Common Files"  echo ERROR: No valid Creo 3.0 build found in %CREO3PATH% (%CREOVERSION%)

Announcements