Jump to content

Help make CMD install on XP x86 only


Recommended Posts

OK so I have this .net aio installer I want to make only install on XP x86, it already has code for it to skip if run on Windows 2000 I would like to use something similar for XP64/Vista*/7*/8* and above

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::                                                        ::::     Installer created by yumeyao with strel's help     ::::                                                        ::::               WaitNET.exe by RogueSpear                ::::                                                        ::::                  Script created with                   ::::         Silent .NET Maker synthesized 20090913         ::::  http://www.msfn.org/board/index.php?showtopic=127790  ::::                                                        ::::         Script modified by yumeyao on 20091023         ::::      Script remodified by ricktendo64 on 20100817      ::::                                                        ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSIONSET VERBOSITY=/quiet&SET VERBOSITYSHORT=/qnIF "%1"=="/qn" SET VERBOSITY=/quiet&SET VERBOSITYSHORT=/qnIF "%1"=="/quiet" SET VERBOSITY=/quiet&SET VERBOSITYSHORT=/qnIF "%1"=="/silent" SET VERBOSITY=/silent&SET VERBOSITYSHORT=/qnIF "%1"=="/qb" SET VERBOSITY=/passive&SET VERBOSITYSHORT=/qbIF "%1"=="/qb!" SET VERBOSITY=/passive&SET VERBOSITYSHORT=/qbIF "%1"=="/passive" SET VERBOSITY=/passive&SET VERBOSITYSHORT=/qbIF NOT EXIST FILEVER.vbs (    ECHO>>FILEVER.vbs Set objFSO = CreateObject^("Scripting.FileSystemObject"^)    ECHO>>FILEVER.vbs Wscript.Echo objFSO.GetFileVersion^(WScript.arguments^(0^)^))FOR /F "DELIMS=. TOKENS=1" %%I IN ('CSCRIPT //NOLOGO FILEVER.vbs "%SYSTEMROOT%\SYSTEM32\MSI.DLL"') DO IF /I "%%I"=="2" (    IF /I "%VERBOSITY%"=="/passive" SET VERBOSITY=/qb!    IF /I "%VERBOSITY%"=="/silent" SET VERBOSITY=/qn    IF /I "%VERBOSITY%"=="/quiet" SET VERBOSITY=/qn)SET SYS2K=1IF EXIST %SYSTEMROOT%\system32\reg.exe (    SET SYS2K=    FOR /F "DELIMS=" %%I IN ('%SYSTEMROOT%\system32\REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName') DO ECHO>DNFWIN1.TXT %%I    FOR /F %%I IN ('FINDSTR/I "2000" DNFWIN1.TXT') DO SET SYS2K=1)IF DEFINED SYS2K GOTO:SYSTEM2KFOR /F "TOKENS=3" %%I IN ('REG QUERY "HKLM\SYSTEM\Setup" /v SystemSetupInProgress') DO SET SSIP=%%IIF /I "%SSIP%"=="0x1" (    SET SSIPAFTERFIX=NO    REG QUERY "HKLM\SOFTWARE\Microsoft\PCHealth\ErrorReporting\DW"    IF NOT ERRORLEVEL 1 SET SSIPAFTERFIX=YES&REG EXPORT "HKLM\SOFTWARE\Microsoft\PCHealth\ErrorReporting\DW" SSIPFIX.REG&REG DELETE "HKLM\SOFTWARE\Microsoft\PCHealth\ErrorReporting\DW" /f    REG ADD "HKLM\SYSTEM\Setup" /v SystemSetupInProgress /t REG_DWORD /d 0 /f)IF EXIST *.TXT DEL /F *.TXTFOR /F %%I IN ('DIR/B DNF30\SYS32') DO (    XCOPY/DY DNF30\SYS32\%%I %SYSTEMROOT%\SYSTEM32    %SYSTEMROOT%\SYSTEM32\REGSVR32 /S %SYSTEMROOT%\SYSTEM32\%%I)START /WAIT DNF40\netfx_core_x86.msi /UPDATE "%CD%\DNF40\kb2468871.msp" %VERBOSITY% /norestartSTART /WAIT WaitNET.exe %VERBOSITYSHORT%START /WAIT DNF40\netfx_Extended_x86.msi /UPDATE "%CD%\DNF40\kb2468871.msp" %VERBOSITY% /norestartSTART /WAIT WaitNET.exe %VERBOSITYSHORT%START /WAIT DNF20\netfx20a_x86.msi VSEXTUI=1 ARPNOMODIFY=1 ARPNOREPAIR=1 TRANSFORMS=MUFIXES20.MST REBOOT=ReallySuppress %VERBOSITY%START /WAIT WaitNET.exe %VERBOSITYSHORT%START /WAIT DNF30\netfx30a_x86.msi VSEXTUI=1 ARPNOMODIFY=1 ARPNOREPAIR=1 TRANSFORMS=REMFONTCACHEFIX.MST;MUFIXES3035.MST %VERBOSITY% /norestartSTART /WAIT WaitNET.exe %VERBOSITYSHORT%START /WAIT DNF35\vs_setup.msi VSEXTUI=1 ARPNOMODIFY=1 ARPNOREPAIR=1 TRANSFORMS=MUFIXES3035.MST %VERBOSITY% /norestartSTART /WAIT WaitNET.exe %VERBOSITYSHORT%START /WAIT DNF11\netfx.msi TRANSFORMS=NETFX11SP1.MST %VERBOSITY% /norestartSTART /WAIT WaitNET.exe %VERBOSITYSHORT%START /WAIT WaitNET.exe %VERBOSITYSHORT% /eIF /I "%SSIP%"=="0x1" (    IF "%SSIPAFTERFIX%"=="YES" REG IMPORT SSIPFIX.REG    REG ADD "HKLM\SYSTEM\Setup" /v SystemSetupInProgress /t REG_DWORD /d 1 /f)GOTO:EOF:SYSTEM2KECHO This version of dotnet cannot be installed on Windows 2000.ECHO>%SYSTEMROOT%\DOTNET5IO.TXT This version of dotnet cannot be installed on Windows 2000.

Thanks for your time

 

Link to comment
Share on other sites


Since Windows version number 5.1 indicates XP, then I believe you should be able to simply change this:

 

...SET SYS2K=1IF EXIST %SYSTEMROOT%\system32\reg.exe (    SET SYS2K=    FOR /F "DELIMS=" %%I IN ('%SYSTEMROOT%\system32\REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName') DO ECHO>DNFWIN1.TXT %%I    FOR /F %%I IN ('FINDSTR/I "2000" DNFWIN1.TXT') DO SET SYS2K=1)IF DEFINED SYS2K GOTO:SYSTEM2K...:SYSTEM2KECHO This version of dotnet cannot be installed on Windows 2000.ECHO>%SYSTEMROOT%\DOTNET5IO.TXT This version of dotnet cannot be installed on Windows 2000.
to:

 

SET "_OSV=" & FOR /f "TOKENS=2 DELIMS=[]" %%G IN ('VER') DO FOR /f "TOKENS=2,3 DELIMS=. " %%H IN ("%%~G") DO SET "_OSV=%%H.%%I"IF NOT "%_OSV%."=="5.1." GOTO:NOTXP...:NOTXPECHO This version of dotnet can only be installed on Windows XP.ECHO>%SYSTEMROOT%\DOTNET5IO.TXT This version of dotnet can only be installed on Windows XP.
EDIT: See posts below about missing "%" marks :)

Cheers and Regards

Edited by bphlpt
Link to comment
Share on other sites

According to this:
 


XP x64 and 2003 is 5.2, but to make absolutely positive you could always include an extra test:
 

SET "_MyArch=x64" & IF %PROCESSOR_ARCHITECTURE%==x86 IF NOT DEFINED PROCESSOR_ARCHITEW6432 SET "_MyArch=x86"IF "%_MyArch%"=="x64" GOTO:NOTXP

EDIT: See posts below about missing "%" marks :)

but it shouldn't be necessary. Test it for sure yourself, of course.

Cheers and Regards

Edited by bphlpt
Link to comment
Share on other sites

To further differentiate XPx64 from Win2003, the following REG_SZ registry value can be checked. I'm sorry I don't have the time to write a proper CMD line to do so...

HKLM,"SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType"
"WinNT" = XP

"ServerNT" = Win2003

Link to comment
Share on other sites

For anyone that is interested in this i used this simply code a long time ago in a batch script.

@ECHO OFFIF NOT "%Processor_Architecture%" == "x86" GOTO IncorrectOSver | find "5.1." 1>NUL && GOTO CorrectOS || GOTO IncorrectOS:CorrectOSECHO Executing Windows Calculator...START "" /WAIT "%WinDir%\system32\calc.exe"PAUSEEXIT:IncorrectOSECHO This dotNET AIO Pack can only be installed on Windows XP 32-bit.PAUSEEXIT
Edited by Jeffery
Link to comment
Share on other sites

First code not working, always skips... Here is the output

E:\Projects\Installers\dotNetFx_AIO_x86>SET "_OSV="   & FOR /F "TOKENS=2 DELIMS=[]" %G IN ('VER') DO FOR /F "TOKENS=2,3 DELIMS=. " %H IN ("%~G") DO SET "_OSV=%H.%I" E:\Projects\Installers\dotNetFx_AIO_x86>FOR /F "TOKENS=2,3 DELIMS=. " %H IN ("Versi¢n 5.1.2600") DO SET "_OSV=%H.%I" E:\Projects\Installers\dotNetFx_AIO_x86>SET "_OSV=5.1" E:\Projects\Installers\dotNetFx_AIO_x86>IF NOT "_OSV." == "5.1." GOTO:NOTXPE:\Projects\Installers\dotNetFx_AIO_x86>ECHO This version of dotnet can only be installed on Windows XP. This version of dotnet can only be installed on Windows XP.E:\Projects\Installers\dotNetFx_AIO_x86>ECHO This version of dotnet can only be installed on Windows XP. 1>C:\WINDOWS\DOTNETAIO.TXT
Link to comment
Share on other sites

Hey Rick,

I think the code was always skipping because you wrote the test as:

IF NOT "_OSV." == "5.1." GOTO:NOTXP

instead of:

IF NOT "%_OSV%."=="5.1." GOTO:NOTXP

EDIT: See posts below about missing "%" marks :)

and batch is sometimes VERY particular about extra spaces, especially in string tests, which this one was. To test this, and since it seems you do not need to keep the value of "_OSV" for any other reason, would you mind substituting these two lines, in separate tests, for the one Yzöwl suggested to see if either of them would also would work? (Which one, or that of Yzöwl, you end up using is completely up to you of course. I think they should all give the same result based on your tests above.)

FOR /f "TOKENS=2 DELIMS=[]" %%G IN ('VER') DO FOR /f "TOKENS=2,3 DELIMS=. " %%H IN ("%%~G") DO IF NOT "%%H.%%I"=="5.1" GOTO:NOTXP...or...FOR /f "TOKENS=2 DELIMS=[]" %%G IN ('VER') DO FOR /f "TOKENS=2,3 DELIMS=. " %%H IN ("%%~G") DO IF %%H.%%I NEQ 5.1 GOTO:NOTXP

EDIT: Yzöwl code included for easy reference:

FOR /F "TOKENS=2 DELIMS=[]" %%A IN ('VER') DO FOR /F "TOKENS=3 DELIMS=." %%B IN ("%%A") DO IF %%B NEQ 2600 GOTO :NOTXP

Cheers and Regards

Edited by bphlpt
Link to comment
Share on other sites

There are also the missing exclamation marks to consider:

IF NOT "_OSV."=="5.1." GOTO:NOTXP
...should be...

IF NOT "!_OSV!."=="5.1." GOTO:NOTXP
Edited by 5eraph
Link to comment
Share on other sites

Well D@mn, [ stupid, stupod, stoopid me! :)  Corrected posts above.]  Thanks 5eraph, though since the IF was not in a FOR loop or nested in any way I think it should have been:
 

IF NOT "%_OSV%."=="5.1." GOTO:NOTXP

 
and not exclamation marks, right?
 
NOTE:  This correction should not effect the last suggested test I made to Rick, since _OSV was not used.
 
Cheers and Regards

Edited by bphlpt
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...