Daniel Dehennin <daniel.dehen...@ac-caen.fr> writes: > For the curious ones, I put a complete example[1] on the wiki ;-)
I just upgrade the examples[1][2] to avoid un DOS parser bug: #v+ IF "%ProgramFiles(x86)%" NEQ "" ( SET PROG_PATH=%ProgramFiles(x86)% ) else ( SET PROG_PATH=%ProgramFiles% ) #v- The closing paren of %ProgramFiles(x86)% in the SET statement close the IF bloc, thanks to the DOS parser. If you need only one variable it can be worked arround like this: #v+ SET PROG_PATH=%ProgramFiles% IF "%ProgramFiles(x86)%" NEQ "" SET PROG_PATH=%ProgramFiles(x86)% #v- Avoiding the need of paren, if you need more than one variable, you can use paren and dos function call (or goto if you prefer): #v+ IF "%ProgramFiles(x86)%" NEQ "" ( call :64bits ) else ( call :32bits ) REM do something with variables :end exit /B %ERRORLEVEL% REM place this at the end of the file to avoid running them again :32bits SET SOFT_PATH=HKLM\SOFTWARE\ SET RUN_PATH=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run SET PROG_PATH=%ProgramFiles% GOTO :EOF :64bits SET SOFT_PATH=HKLM\Software\Wow6432Node\ SET RUN_PATH=HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Run SET PROG_PATH=%ProgramFiles(x86)% GOTO :EOF #v- Thanks. Footnotes: [1] http://wpkg.org/User:Dad#.25SOFTWARE.25.5Cadobe.5Creader.5C9.4.0.5Cpostinstall.cmd [2] http://wpkg.org/User:Dad#.25SOFTWARE.25.5Cadobe.5Creader.5C9.4.0.5Cpostremove.cmd -- Daniel Dehennin RAIP de l'Orne
pgpbKSg87TzZU.pgp
Description: PGP signature
------------------------------------------------------------------------- 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