[wpkg-users] Detecting Windows 7?

Adam Williams awilliam at mdah.state.ms.us
Mon Sep 28 17:12:18 CEST 2009


here is a cut and paste from Rainer a few days ago for IE8, you should 
be able to adapt the script to your needs, be sure to use Rainer's 
silent install scripts, i can forward you those if needed.

Hi Justin,

Justin Brinegar wrote:

> > We plan to use the output of the ver command to differentiate in
> > scripts, but I just wondered if a better way existed.
>   

I am using exactly this approach for my Internet Explorer 8 package:

@echo off

set PROGRAM_NAME=Internet Explorer
set LANG_SUFFIX=ENU
set INSTALLER_TYPE=custom
set INSTALLER=install.cmd
set INSTALLER_LOC=%~dp0
set CMDPATH=%~dpn0

REM Detect Windows version
VER | findstr /i "5\.0\." > nul
IF %ERRORLEVEL% EQU 0 (
    echo Windows  2000 found
    REM Windows 2000 (no binaries yet)
    exit 2
)

ver | findstr /i "5\.1\." > nul
IF %ERRORLEVEL% EQU 0 (
    echo Windows XP found
    set CMD32=IE8-WindowsXP-x86-%LANG_SUFFIX%.exe
    set CMD64=IE8-WindowsXP-x86-%LANG_SUFFIX%.exe
    goto continue
)
echo test
ver | findstr /i "5\.2\." > nul
IF %ERRORLEVEL% EQU 0 (
    echo Windows Server 2003 found
    exit 2
)

ver | findstr /i "6\.0\." > nul
IF %ERRORLEVEL% EQU 0 (
    echo Windows Vista found
    set CMD32=IE8-WindowsVista-x86-%LANG_SUFFIX%.exe
    set CMD64=IE8-WindowsVista-x64-%LANG_SUFFIX%.exe
    goto continue
)
ver | findstr /i "6\.1\." > nul
IF %ERRORLEVEL% EQU 0 (
    REM Windows 7
    exit 0
)
if "%CMD32%" == "" exit 3
:continue

if exist "%INSTALLER_LOC%unattended-preinstall.cmd" (
	call "%INSTALLER_LOC%unattended-preinstall.cmd"
	if "%~n0" == "unattended" goto install
)

if exist "%CMDPATH%-preinstall.cmd" (
	call "%CMDPATH%-preinstall.cmd"
)

:install
echo Installing %PROGRAM_NAME%

set PROGRAM_FILES=%ProgramFiles%
if not "%ProgramFiles(x86)%" == "" set PROGRAM_FILES=%ProgramFiles(x86)%

echo Installing %CMD32%, %CMD64%
call "%INSTALLER_LOC%%INSTALLER%" %INSTALLER_TYPE% "%CMD32%" "%CMD64%" ""
"/quiet /update-no /no-default /norestart"
set EXIT_CODE=%ERRORLEVEL%

if exist "%CMDPATH%-postinstall.cmd" (
	call "%CMDPATH%-postinstall.cmd"
	if "%~n0" == "unattended" goto end
)

if exist "%INSTALLER_LOC%unattended-postinstall.cmd" (
	call "%INSTALLER_LOC%unattended-postinstall.cmd"
)

:end
exit /B %EXIT_CODE%



br,
Rainer
-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
_______________________________________________
wpkg-users mailing list
wpkg-users at lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/wpkg-users



Kevin Keane wrote:
> I am trying to use WPKG to install Windows Administation tools. There 
> are different versions for XP/Vista and for Windows 7, so I am looking 
> for a good way to detect the operating system type within a 
> package-installation command.
>
> What is a good way to do this?
>
> Thanks!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/wpkg-users/attachments/20090928/817f303a/attachment-0002.html>


More information about the wpkg-users mailing list