[wpkg-users] Deploy different versions of wpkg dependent on XP/Seven
Daniel Dehennin
daniel.dehennin at ac-caen.fr
Tue Feb 8 11:42:27 CET 2011
Daniel Dehennin <daniel.dehennin at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.wpkg.org/pipermail/wpkg-users/attachments/20110208/ecd078c2/attachment.sig>
More information about the wpkg-users
mailing list