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?
Solved! Go to Solution.
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").
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
** 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%)