@echo off

rem #--------------------------------#
rem # Read User settings in registry #
rem #--------------------------------#

rem # Read the registry setting "Local AppData" and set 
rem # the environment CMI_CSIDL_LOCAL_APPDATA.
rem #
rem # By default %CMI_CSIDL_LOCAL_APPDATA% looks like:
rem # C:\Documents and Settings\%USERNAME%\Local Settings\Application Data
rem #
rem # If the user is not allowed to execute Regedit.exe or to create 
rem # files in %TEMP%, the administrator can remove the following command
rem # and set the environment CMI_CSIDL_LOCAL_APPDATA manually. 
rem # Note: The setting depends on the language settings.

REGEDIT /E "%Temp%.\.CMI.reg" "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
FOR /F "tokens=2 delims==" %%A IN ('FIND /I "Local AppData" "%Temp%.\.CMI.reg"') DO SET LOCAL_APPDATA=%%A
IF EXIST "%Temp%.\CMI.reg" DEL "%Temp%.\.CMI.reg"
echo set CMI_CSIDL_LOCAL_APPDATA=%%~f1> "%Temp%.\.CMI.bat"
call "%Temp%.\.CMI.bat" "%LOCAL_APPDATA:~1,-1%"
SET LOCAL_APPDATA=
IF EXIST "%Temp%.\CMI.bat" DEL "%Temp%.\.CMI.bat"

rem #--------------------------------#
rem # CATIA settings                 #
rem #--------------------------------#

