Previous article
Next article

3.3.1 Script-based installation for version 30 SP2024

Here's an example of a simple batch file, without checking the version already installed, to install version 30 SP2024 from the existing update folder. This update folder can be populated by the offline setup: with catalogs, cadworkprofil and userprofil.

In the script below, for some modules, the presence in the folder is not tested. The reason for this is that their installation is compulsory, and the executables are automatically downloaded during a standard update, and are present in the offline setup.

@ECHO off 

:: Definition of variables
:: Definition of date and time
SET YEAR=%DATE:~6,4%
SET MONTH=%DATE:~3,2%
SET DAY=%DATE:~0,2%
SET HOUR=%TIME:~0.2%
SET MINUTES=%TIME:~3.2%


:: Definitions of cadwork variables
:: Both the customer number and the language are essential for installation. 
:: The wrong customer number will lead to installation or license errors.
:: The language chosen will have an impact on the catalogs to be installed.
:: Please contact cadwork support if necessary.

SET UPDATE=FALSE
SET REMOVE=FALSE
SET VERSION=30.0
SET CLIENTNUMBER=04.12345.0
SET LANGUAGE=english
:: Network paths must be in UNC format.
SET CADWORKDIR=%programfiles%\cadwork.dir
SET UPDATEDIR=\srv001\public\cadwork\update
SET USERPROFILEDIR=\srv001\public\cadwork\userprofil_%VERSION:~0,2%
SET USERCATALOGDIR=\srv001\public\cadwork\cadwork.cat

:: Define the location of the log file
SET INSTALLLOGDIR=\srv001\public\cadwork\Logs_dir

:: Define the log file with date and time in the desired format
SET LOGFILE=%INSTALLLOGDIR%\%YEAR%_%MONTH%_%DAY%_%HOUR%_%MINUTES%.txt


:: Calls the main script "main" and redirects standard output and errors
:: to the log file.
CALL :main > %LOGFILE% 2>&1


:: End of script
PAUSE
ECHO Installation complete. We hope you enjoy
GOTO EOF


:: Uninstallation
if %REMOVE%==TRUE goto :REMOVE


:main
ECHO %DATE% - %TIME% - SCRIPT START

:: Module installation (First installation and update)
:: Program part
:: At the root of the CADWORKDIR folder
:: Ci-Start program
IF EXIST "%UPDATEDIR%\EXE\cadwork_CI-Start_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_CI-Start_%VERSION%_x64.exe" /dir="%CADWORKDIR%" /verysilent
ECHO ci_start - Installation complete
) ELSE (
ECHO The Ci-Start installer, a mandatory component, is missing)

:: Ci-Com module
IF EXIST "%UPDATEDIR%\EXE\cadwork_CI-COM_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_CI-COM_%VERSION%_x64.exe" /dir="%CADWORKDIR%" /verysilent
ECHO Ci-Com - Installation finished
) ELSE (
ECHO Ci-Com - Installer not found)

:: Subfolder by cadwork version
:: Module 2D
IF EXIST "%UPDATEDIR%\EXE\cadwork_2D_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_2D_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0,2%" /verysilent
ECHO 2D - Installation finished
) ELSE (
ECHO Module 2D - Installer not found)

:: Module 2DV
IF EXIST "%UPDATEDIR%\EXE\cadwork_2DV_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_2DV_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0,2%" /verysilent
ECHO 2DV - Installation finished
) ELSE (
ECHO Module 2DV - Installer not found)

:: Module 3D
IF EXIST "%UPDATEDIR%\EXE\cadwork_3D_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_3D_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0,2%" /verysilent
ECHO 3D - Installation finished
) ELSE (
ECHO Module 3D - Installer not found)

:: Module Database (3D textures and metal profiles)
IF EXIST "%UPDATEDIR%\EXE\cadwork_Database_%VERSION%.exe" (
"%UPDATEDIR%\EXE\cadwork_Database_%VERSION%.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0,2%" /verysilent
ECHO Module Database - Installation finished
) ELSE (
ECHO Module Database - Installer not found)

:: Cadwork Design Module (also known as Lexodad)
IF EXIST "%UPDATEDIR%\EXE\cadwork_Lexocad_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_Lexocad_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0,2%" /verysilent
ECHO Module Cadwork Conception - Installation finished
) ELSE (
ECHO Module Cadwork Conception - Installer not found)

:: List module
IF EXIST "%UPDATEDIR%\EXE\cadwork_List_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_List_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0,2%" /verysilent
ECHO Module List - Installation finished
) ELSE (
ECHO Module List - Installer not found)

:: LxSDK module (some libraries required)
IF EXIST "%UPDATEDIR%\EXE\cadwork_LxSDK_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_LxSDK_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0,2%" /verysilent
ECHO Module LxSDK - Installation finished
) ELSE (
ECHO Module LxSDK - Installer not found - Libraries required for 3D are missing)

:: Pclib module (Libraries common to all modules)
IF EXIST "%UPDATEDIR%\EXE\cadwork_Pclib_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_Pclib_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0,2%" /verysilent
ECHO Module Pclib - Installation finished
) ELSE (
ECHO Module Pclib - Installer not found - Mandatory libraries for all modules are missing)

:: OptiPanels module
IF EXIST "%UPDATEDIR%\EXE\cadwork_OptiPanel_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_OptiPanel_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0,2%" /verysilent
ECHO OptiPanel - Installation finished
) ELSE (
ECHO Module List - Installer not found)


:: Subfolder by cadwork version - "PI" subfolder - Module dependent on license.
:: Lamel Module (For laminators, producers of glued laminates)
:: This module may not be present as it depends on the customer number.
IF EXIST "%UPDATEDIR%\EXE\cadwork_Lamel_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_Lamel_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0,2%" /verysilent
ECHO Lamel - Installation finished
) ELSE (
ECHO Lamel - Installer not found)


:: Subfolder by cadwork version - Existing cadwork modules up to and including version 26
:: Module 2DM 
IF EXIST "%UPDATEDIR%\EXE\cadwork_2DM_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_2DM_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0,2%" /verysilent
ECHO 2DM - Installation complete
) ELSE (
ECHO 2DM - Installer not found)

:: Connect module (directly implemented in the "Window -> Leica Toolbar" menu)
IF EXIST "%UPDATEDIR%\EXE\cadwork_Connect_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_Connect_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0.2%" /verysilent
ECHO Connect - Installation complete
) ELSE (
ECHO Connect - Installer not found)

:: Lexoview module 
:: Replaced by WebViewer export (HTML format) or by BIMTeam (Web solution hosted by cadwork)
IF EXIST "%UPDATEDIR%\EXE\cadwork_Lexoview_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_Lexoview_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0,2%" /verysilent
ECHO Lexoview - Installation finished
) ELSE (
ECHO Lexoview - Installer not found)


:: Subfolder by cadwork version - Module for road engineers (Civil Engineering)
IF EXIST "%UPDATEDIR%\EXE\cadwork_2DR_%VERSION%_x64.exe" (
"%UPDATEDIR%\EXE\cadwork_2DR_%VERSION%_x64.exe" /dir="%CADWORKDIR%\EXE_%VERSION:~0.2%" /verysilent
ECHO 2DR - Installation complete
) ELSE (
ECHO 2DR - Installer not found)


:: Cadwork and cadworkprofil catalogs (First installation and update)
:: According to fixed folder defined by cadwork (cannot be changed by user)
:: Architecture catalogs
IF EXIST "%UPDATEDIR%\CAT\%LANGUAGE%\architecture_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" (
"%UPDATEDIR%\CAT\%LANGUAGE%\architecture_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" /verysilent
ECHO Catalogues Architecture - Installation finished
) ELSE (
ECHO Catalogues Architecture - Installer not found)

:: Plugins created by Cadwork (cadworkprofil)
IF EXIST "%UPDATEDIR%\CAT\%LANGUAGE%\cadworkprofil_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" (
"%UPDATEDIR%\CAT\%LANGUAGE%\cadworkprofil_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" /verysilent
ECHO Cadworkprofil - Installation finished
) ELSE (
ECHO Cadworkprofil - Installer not found)

:: Catalogues 2D
IF EXIST "%UPDATEDIR%\CAT\%LANGUAGE%\catalog_2d_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" (
"%UPDATEDIR%\CAT\%LANGUAGE%\catalog_2d_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" /verysilent
ECHO Catalogues 2D - Installation finished
) ELSE (
ECHO Catalogues 2D - Installer not found)

:: 3D Catalogues
IF EXIST "%UPDATEDIR%\CAT\%LANGUAGE%\catalog_3d_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" (
"%UPDATEDIR%\CAT\%LANGUAGE%\catalog_3d_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" /verysilent
ECHO Catalogues 3D - Installation finished
) ELSE (
ECHO Catalogues 3D - Installer not found)

:: Manuals cadwork
IF EXIST "%UPDATEDIR%\CAT\%LANGUAGE%\manual_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" (
"%UPDATEDIR%\CAT\%LANGUAGE%\manual_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" /verysilent
ECHO Manuals cadwork - Installation finished
) ELSE (
ECHO Manuals cadwork - Installer not found)

:: What's new in this version
IF EXIST "%UPDATEDIR%\CAT\%LANGUAGE%\news_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" (
"%UPDATEDIR%\CAT\%LANGUAGE%\news_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" /verysilent
ECHO Novelties - Installation complete
) ELSE (
ECHO Novelties - Installer not found)

:: Variant catalogs (parametric catalog files)
IF EXIST "%UPDATEDIR%\CAT\%LANGUAGE%\variant_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" (
"%UPDATEDIR%\CAT\%LANGUAGE%\variant_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" /verysilent
ECHO Catalogues Variants - Installation complete
) ELSE (
ECHO Novelties - Installer not found)

:: Video catalogs (links to training videos on YouTube, Vimeo or other online platforms)
IF EXIST "%UPDATEDIR%\CAT\%LANGUAGE%\videos_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" (
"%UPDATEDIR%\CAT\%LANGUAGE%\videos_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" /verysilent
ECHO Catalogues videos - Installation finished
) ELSE (
ECHO Catalogues videos - Installer not found)


:: Userprofil (here on the network and not to be installed by each customer)
IF EXIST "%USERPROFILEDIR%" (
ECHO userprofil deja installes
) ELSE (
"%UPDATEDIR%\CAT\%LANGUAGE%\userprofil_%LANGUAGE%_%CLIENTNUMBER:~0,2%_%VERSION%.exe" /dir="%USERPROFILEDIR%" /verysilent
ECHO Userprofil - Installation complete)
ECHO Installation complete

ECHO %DATE% - %TIME% - END OF SCRIPT
PAUSE
:: The update is complete here

:: This batch is not intended for updating. 
:: Therefore, if the UPDATE variable is set to "TRUE", nothing will happen
IF %UPDATE%==TRUE GOTO EOF
:: For the first installation:
:: - Register customer number
ECHO %CLIENTNUMBER% > "%CADWORKDIR%\CLIENT_NR.TXT"

:: - VCRedist is mandatory, DirectX 9c may have to be installed manually
"%CADWORKDIR%\exe_%VERSION:~0,2%\pclib.x64\redist\vcredist_x64\vcredist2015-2022_x64.exe" /install /quiet /norestart

:: - Create shortcuts and registry entries via cadwork start
"%CADWORKDIR%\ci_start.exe" /INSTALL /SILENT /USP="%USERPROFILEDIR%" /CATDIR="%USERCATALOGDIR%" /DownloadDir="%UPDATEDIR% /USER_HOLZ
IF NOT EXIST "%PROGRAMDATA%\Firebird\" MKDIR "%PROGRAMDATA%\Firebird"


PAUSE
GOTO EOF


:: Remove a local installation
:: - UPDATEDIR, USERPROFILEDIR and USERCATALOGDIR are located on the network and are therefore not removed here
:REMOVE
IF EXIST "%CADWORKDIR%\ci_start.exe" "%CADWORKDIR%\ci_start.exe" /UNINSTALL /SILENT
IF EXIST "%CADWORKDIR\%" RMDIR /s /q "%CADWORKDIR%"
IF EXIST "%PROGRAMDATA%\cadwork\" RMDIR /s /q "%PROGRAMDATA%\cadwork"
IF EXIST "%PROGRAMDATA%\Firebird\" RMDIR /s /q "%PROGRAMDATA%\Firebird"
IF EXIST "%Public%\documents\cadwork\" RMDIR /s /q "%Public%\documents\cadwork"
IF EXIST "%AppData%\cadwork\" RMDIR /s /q "%AppData%\cadwork"
Pause