08/23
18:21
日记

Catia 部署脚本

分享一个Catia的部署脚本

@echo off&setlocal enabledelayedexpansion
:: Get Administrator Rights
set "_FilePath=%~f0"
fltmc >nul 2>&1 || (
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\GetAdmin.vbs"
    echo UAC.ShellExecute "!_FilePath!", "", "", "runas", 1 >> "%temp%\GetAdmin.vbs"
    "%temp%\GetAdmin.vbs"
    del /f /q "%temp%\GetAdmin.vbs" >nul 2>&1
    exit
)
::当前登录用户的Profile文件夹位置,如果没人登录,配置文件放到default用户下
set logonuser0=Default
for /f "skip=1 tokens=1" %%i in ('quser') do set logonuser0=%%i
set logonUserAppData=C:\Users\%logonuser0:>=%\AppData\Roaming\DassaultSystemes
::安装Catia
"\\SHFS\Public_Folder\IT\Software\Catia\CATIA_P3_V5R21_Win64\WIN64\StartB.exe" -u C:\CatiaV5\R21 -ident R21 -newdir -D C:\CATEnv -addUserPrivilegesForOrbix -v -all -noreboot
msiexec /q /i %fileserver%Software\Catia\CATIA_P3_V5R21_Win64\VBA\vba6.msi
::配置CATReferenceSettingPath和CATUserSettingPath两个环境变量
xcopy \\shfs\Public_Folder\IT\Software\Catia\ReferenceSettings C:\ProgramData\DassaultSystemes\ReferenceSettings /I /S /C /Y
"C:\CatiaV5\R21\win_b64\code\bin\chcatenv.exe" -e CATIA_P3.V5R21.B21 -a global -var CATReferenceSettingPath=C:\ProgramData\DassaultSystemes\ReferenceSettings
"C:\CatiaV5\R21\win_b64\code\bin\chcatenv.exe" -e CATIA_P3.V5R21.B21 -a global -var DSY_DISABLE_WININET=TRUE -new
xcopy \\shfs\Public_Folder\IT\Software\Catia\CATSettings %logonUserAppData%\CATSettings /I /S /C /Y
"C:\CatiaV5\R21\win_b64\code\bin\chcatenv.exe" -e CATIA_P3.V5R21.B21 -a global -var CATUserSettingPath=CSIDL_APPDATA\DassaultSystemes\CATSettings
::写入许可证服务器信息
if not exist "C:\ProgramData\DassaultSystemes\Licenses\DSLicSrv.txt" mkdir "C:\ProgramData\DassaultSystemes\Licenses\"
echo lic.hida.in:4085 >"C:\ProgramData\DassaultSystemes\Licenses\DSLicSrv.txt"

Catia 部署脚本