Hi Stefan, Pendl Stefan wrote: > Hi Rainer, > so if one uses batch files to choose the correct installer he has to use > them for the other tasks too. > Thanks for the info.
You don't need to use the same method for install/uninstall - you could also hard-code it in the package. However I found it much more flexible to have a generic "installer.cmd" script which handles all common installers generically. Sure, the main reason was that I always forgot about the correct switches for NSIS, MSI, Wise and others. So I wrote this installer.cmd script. In case of MSI scripts it's very easy to uninstall as the MSI file can be used for this. For other installers it's usually a different procedure depending on the program. For example I use the following script for lots of programs which have an uninstaller within program files: unattended-uninstall.cmd: @echo off echo Removing Application set PROGRAM_FILES=%ProgramFiles% if not "%ProgramFiles(x86)%" == "" set PROGRAM_FILES=%ProgramFiles(x86)% start /wait "Remove" "%PROGRAM_FILES%\Program\Uninstall.exe" /S This script supports 32-bit and 64-bit OS as well. > BTW, I noticed that your install batch file has a spelling error in the > custom installer procedure it set the exit code to ERRORLEEL (missing V) ;-) Oh my ... ;-) Well, custom installers are not used very widely, so you can see I am using one of the pre-defined procedures for 99.xx% of my packages. Anyway, thanks a lot for review, I just updated my sources! By the way, if you have multiple languages I use a similar script as well: unattended.cmd: @echo off REM Runs .\unattended-[lang].cmd according to system language. REM Runs .\unattended-uninstall-[lang].cmd according to system language. set INSTALL_LOC=%~dp0 set INSTALL_PREFIX=unattended set UNINSTALL_PREFIX=unattended-uninstall set LANG_SUFFIX=-en set SCRIPT_SUFFIX=.cmd set EXIT_CODE=0 set KEY="hklm\system\controlset001\control\nls\language" REM Detect language :select if "%LANG%" == "en" goto en if "%LANG%" == "enu" goto en if "%LANG%" == "de" goto de if "%LANG%" == "deu" goto de goto detect :detect for /f "Skip=1 Tokens=3*" %%i in ('reg QUERY %KEY% /v Installlanguage') do set language=%%i if "%language%" == "0407" ( set LANG=de goto select ) if "%language%" == "0409" ( set LANG=en goto select ) REM if "%ProgramFiles%" == "C:\Programme" ( REM set LANG=de REM goto select REM ) REM if "%ProgramFiles%" == "C:\Programme (x86)" ( REM set LANG=de REM goto select REM ) set LANG=en goto select :de set LANG_SUFFIX=-de goto execute :en set LANG_SUFFIX=-en goto execute :execute if "%~n0" == "%UNINSTALL_PREFIX%" goto executeUninstall goto executeInstall :executeInstall call "%INSTALL_LOC%%INSTALL_PREFIX%%LANG_SUFFIX%%SCRIPT_SUFFIX%" set EXIT_CODE=%ERRORLEVEL% goto end :executeUninstall call "%INSTALL_LOC%%UNINSTALL_PREFIX%%LANG_SUFFIX%%SCRIPT_SUFFIX%" set EXIT_CODE=%ERRORLEVEL% goto end :end exit /B %EXIT_CODE% Note: The script just executes unattended-%LANG%.cmd (e.g. unattended-en.cmd or unattended-de.cmd) depending on the system language. You might easily extend this script with other languages. Also note that the "unattended-xy.cmd" script is then identical to the script I already posted to invoke instal.cmd with correct parameters. This approach perfectly allows me to install different languages and automatically detect 64-bit and 32-bit sources. Call trace: unattended.cmd | |-> unattended-en.cmd | |- install.cmd | |-> program installer | (32-bit or 64-bit depending on system) |-> unattended-de.cmd |-> install.cmd |-> program installer (32-bit or 64-bit depending on system) The script above can be simply renamed to unattended-uninstall.cmd to achieve the same for uninstall: Call trace: unattended-uninstall.cmd | |-> unattended-uninstall-en.cmd | |- install.cmd | |-> program installer | (32-bit or 64-bit depending on system) |-> unattended-uninstall-de.cmd |-> install.cmd |-> program installer (32-bit or 64-bit depending on system) Some of you might find this cumbersome but it is extremely flexible (allows all languages in 64-bit as well as 32-bit) and the scripts are always the same (but very flexible and extensible). This works perfectly for me since years. In addition I like to have an "unattended.cmd" script in each program directory. So I can copy it on a memory stick, take it to a customer and just double-click unattended.cmd and it will automatically apply the right version for his system (system language and architecture). Even without WPKG. br, Rainer ------------------------------------------------------------------------- wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/ _______________________________________________ wpkg-users mailing list wpkg-users@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/wpkg-users