ricktendo Posted May 16, 2014 Share Posted May 16, 2014 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® EXPORT "HKLM\SOFTWARE\Microsoft\PCHealth\ErrorReporting\DW" SSIPFIX.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 More sharing options...
bphlpt Posted May 16, 2014 Share Posted May 16, 2014 (edited) 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 May 23, 2014 by bphlpt Link to comment Share on other sites More sharing options...
ricktendo Posted May 16, 2014 Author Share Posted May 16, 2014 Thanks... Do you know if XP x64 is also v5.1 Link to comment Share on other sites More sharing options...
MHz Posted May 16, 2014 Share Posted May 16, 2014 Hi rickendo, XP x64 is v5.2 as mentioned here. Perhaps this recent topic here about getting Windows versions may also help since your 1st post mentions many OSes. Link to comment Share on other sites More sharing options...
bphlpt Posted May 16, 2014 Share Posted May 16, 2014 (edited) According to this: Since Windows version number 5.1 indicates XP, ...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:NOTXPEDIT: See posts below about missing "%" marks but it shouldn't be necessary. Test it for sure yourself, of course.Cheers and Regards Edited May 23, 2014 by bphlpt Link to comment Share on other sites More sharing options...
Guest Posted May 16, 2014 Share Posted May 16, 2014 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 More sharing options...
ricktendo Posted May 16, 2014 Author Share Posted May 16, 2014 (edited) Thanks guys for all the help, I think I will use first code Edited May 16, 2014 by ricktendo Link to comment Share on other sites More sharing options...
Jeffery Posted May 23, 2014 Share Posted May 23, 2014 (edited) 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 May 23, 2014 by Jeffery Link to comment Share on other sites More sharing options...
ricktendo Posted May 23, 2014 Author Share Posted May 23, 2014 First code not working, always skips... Here is the outputE:\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 More sharing options...
Yzöwl Posted May 23, 2014 Share Posted May 23, 2014 What about something like this instead?FOR /F "TOKENS=2 DELIMS=[]" %%A IN ('VER') DO FOR /F "TOKENS=3 DELIMS=." %%B IN ("%%A") DO IF %%B NEQ 2600 GOTO :NOTXP Link to comment Share on other sites More sharing options...
ricktendo Posted May 23, 2014 Author Share Posted May 23, 2014 What about something like this instead?FOR /F "TOKENS=2 DELIMS=[]" %%A IN ('VER') DO FOR /F "TOKENS=3 DELIMS=." %%B IN ("%%A") DO IF %%B NEQ 2600 GOTO :NOTXPWorks like a charm! Link to comment Share on other sites More sharing options...
bphlpt Posted May 23, 2014 Share Posted May 23, 2014 (edited) Hey Rick,I think the code was always skipping because you wrote the test as:IF NOT "_OSV." == "5.1." GOTO:NOTXPinstead of:IF NOT "%_OSV%."=="5.1." GOTO:NOTXPEDIT: 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:NOTXPEDIT: 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 :NOTXPCheers and Regards Edited May 24, 2014 by bphlpt Link to comment Share on other sites More sharing options...
Guest Posted May 23, 2014 Share Posted May 23, 2014 (edited) 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 May 23, 2014 by 5eraph Link to comment Share on other sites More sharing options...
bphlpt Posted May 23, 2014 Share Posted May 23, 2014 (edited) 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 May 23, 2014 by bphlpt Link to comment Share on other sites More sharing options...
jaclaz Posted May 23, 2014 Share Posted May 23, 2014 and not exclamation marks, right? Since ENABLEDELAYEDEXPANSION is explicited, that won't make a difference. jaclaz Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now