midiboy Posted January 1, 2005 Share Posted January 1, 2005 Hi guys,I hope you can help me out here ... Is there an easy way (for a non programmer like myself) to test for the presence of an SSE2 capable CPU during an unintended installation ? I would like to add ffdshow to my unattended installation but there are SSE2 special versions available so in case a SSE2 capable CPU is present, an optimized version should be installed of course.Also ... I would like to test for the presence of an Intel Chipset during installation because the usual winnt.sif way of installing the Intel Chipset drivers do not install the Intel disk drivers. Instead one has to call the Setup program using the -INTELIDE switch. However, on a Non Intel Chipset this will cause an error of course.Thanks for any help you can give !Happy new year !! Bye,Alex Link to comment Share on other sites More sharing options...
midiboy Posted January 2, 2005 Author Share Posted January 2, 2005 No one ?? I did a search but couldn´t dig up anything useful ...Thanks,Alex Link to comment Share on other sites More sharing options...
Shotgun Posted January 2, 2005 Share Posted January 2, 2005 Check these links:http://web.inter.nl.net/hcc/J.Steunebrink/chkcpu.htmThis is a command line util. Output can be redirected to a file, then the file scanned to check what you need. The option most helpful for what you need is: CHKCPU /V >> file.txthttp://www.cpuid.com/cpuz.php4This utility has a "ghost" mode that the output gets directed to text file. you might want to try this: cpuz -file=test.txtIt also detects the HW chipset.For the Intel Chipset thing: For identifying I know that Everest Home edition allows to write a hw report to a text file. Checking the text file could be a possible solution to your problem. Also, everest does not need to be installed to use it, you could run it on a hidden cmd windows from a cd folder, then (with cmd-line parameters) specify that the report be written to a text file. There are some members here, like un4given1, that are cmd-line gurus. If you need to check for a particular string in a text file, he might be able to help. You may want to check this thread. I have an Intel Chipset, but I have not tried to do an Unattended install of the Intel drivers yet (mostly use UACDs for my work). When you say the Intel disk drivers, you mean IDE drivers? Have you tried to extract the files from the setup.exe file with 7-zip? I checked mine, and I can extract the contents from the exe file. Also, you might try and get a look at the My Drivers utility. This utility allows you to backup the drivers files you have installed on your system. Link to comment Share on other sites More sharing options...
midiboy Posted January 2, 2005 Author Share Posted January 2, 2005 Hi shotgun,thanks for your detailed answer ! I have quickly tried both Chkcpu and CPUZ with your commands. The first one adds this to the file:SSE2 support : Yeswhich should make it hard to use that information since it will only toggle yes or no and the word "SSE2" will always be in that file.CPUZ on the other hand seems to be more useful because it gives this information amongst others:Instructions Sets MMX, SSE, SSE2So I guess this means on an non SSE2 capable system, the word SSE2 will not appear in the text file.However, I do not yet know what commands I would need inside a RUNONCEX.cmd (!!) to check for that phrase in that file. I guess something like "if exists SSE2 in file.txt then reg add ... SSE2 version ""if not exists SSE2 in file.txt then reg add .... normal version"But honestly, I don´t know the exact code. The above is just a wild guess .. As for the Intel Chipset, CPUZ, as you said, also detects the chipset but I cannot look for the word "INTEL" since the CPU is also described as INTEL ... When you say the Intel disk drivers, you mean IDE drivers? Have you tried to extract the files from the setup.exe file with 7-zip? I checked mine, and I can extract the contents from the exe file.Yes, I mean the IDE drivers. I do install all the chipset drivers using the winnt.sif method and it does work fine for all chipsets BUT ... a normal installation will use the Microsoft pci.sys IDE drivers and not the intelide.sys drivers. Only if you install the Intel Chipset drivers using the -INTELIDE switch, will Windows use the intelide.sys driver.Thanks,Alex Link to comment Share on other sites More sharing options...
Shotgun Posted January 3, 2005 Share Posted January 3, 2005 which should make it hard to use that information since it will only toggle yes or no and the word "SSE2" will always be in that file.Not if the SSE2 line is ALWAYS in the same place (not checked it thou) Even if the line changes, it would be a matter of searching for SSE2 then the YES or NO part. But as you mention, the CPUz maybe more useful for checking that. As for the Intel Chipset, CPUZ, as you said, also detects the chipset but I cannot look for the word "INTEL" since the CPU is also described as INTEL ...Ok. But it also reports the Chipset and IDE Controller. That's the section I believe will help you most. It reports the manufacturer (INTEL) only in the IDE Controller section, but in the CHIPSET it reports the chipset version in the Northbridge? and Southbridge sections. I guess something like "if exists SSE2 in file.txt then reg add ... SSE2 version ""if not exists SSE2 in file.txt then reg add .... normal version"But honestly, I don´t know the exact code. The above is just a wild guess .I believe you would need to use FINDSTR (windows 2000/XP). It searches for a string within a text file. I'll keep searching for a quick way to use it for what you need. Link to comment Share on other sites More sharing options...
midiboy Posted January 3, 2005 Author Share Posted January 3, 2005 Hi Shotgun,I believe you would need to use FINDSTR (windows 2000/XP). It searches for a string within a text file. I'll keep searching for a quick way to use it for what you need.Thats lovely ! THANKS !Alex Link to comment Share on other sites More sharing options...
Shotgun Posted January 3, 2005 Share Posted January 3, 2005 Got it! Try this (TESTSSE2.BAT):@echo offchkcpu /v | findstr "SSE2" | findstr "No" > NULrem echo %errorlevel%if not errorlevel 1 echo No SSE2 support! & goto endif errorlevel 1 echo Processor supports SSE2! & goto end:endWhat this does is that the output of chkcpu gets redirected to the first findstr, which finds the line with "SSE2", then that output gets redirected to the 2nd findstr which tests for "No" in the output of the previous command. This 2nd output is redirected to NUL so that nothing is displayed. If you want to check it you can remove the "> NUL" part. The remark (REM) is to show the value returned. I commented it out in case you want to change something and test.That single line outputs 0 if the SSE2 has a No and a 1 otherwise. The following lines just test the value returned and echo the appropiate message. Hope that helps! Link to comment Share on other sites More sharing options...
midiboy Posted January 3, 2005 Author Share Posted January 3, 2005 Argh, my head is spinning ! Thanks, first of all for your help ! I do not completely understand your wonderful piece of code yet but I will nevertheless try it out !However, now I get a "0" or a "1" right ? So what do I do know with those numbers ? Remember, I am in a runonceex.cmd so I think (?) I need something like "if exists" or "f not exists" ... but I am not sure ...Sorry, for being such a neewb in these things ... Thanks,Alex Link to comment Share on other sites More sharing options...
midiboy Posted January 3, 2005 Author Share Posted January 3, 2005 Hi again,after thinking about it for a while I came up with a solution:@echo offSET CDROM=%CD:~0,2%%CDROM%\SETUP\Codecs\CHKCPU.EXE /v | findstr "SSE2" | findstr "No" > NULrem echo %errorlevel%if not errorlevel 1 goto NoSSE2if errorlevel 1 goto SSE2:NoSSE2start %CDROM%\SETUP\Codecs\ffdshow\ffdshow-20041012.exe /Sgoto end:SSE2start %CDROM%\SETUP\Codecs\ffdshow\SSE2\ffdshow-20041012-sse2.exe /Sgoto end:endexitWould this work ? I will test it right away, however I have no idea how to do all that in a runonceex.cmd ...But if it works, thats at least a good start ! Thanks,Alex Link to comment Share on other sites More sharing options...
midiboy Posted January 3, 2005 Author Share Posted January 3, 2005 Well,the SSE checking works but %CDROM% is not working in that bat file although it is working fine in runonceex.cmd Any other way to fill the %CDROM% variable with the correct drive letter during installation except for placing text files into the DVD root directory as explained in the FAQ ? I don´t like that too much, it´s kind of cheap I would prefer to have all my code in runonceex anyway ... Thanks,Alex Link to comment Share on other sites More sharing options...
Shotgun Posted January 5, 2005 Share Posted January 5, 2005 except for placing text files into the DVD root directory as explained in the FAQ ? I don´t like that too much, it´s kind of cheap You could also check for a file that ONLY exists in the root dir of the CD drive you are installing from. The method mentioned in the FAQ works if you have more than one CD drive. I use the GetCD program to set my %CDROM% variable. Check for info about it here: http://www.msfn.org/board/index.php?showtopic=32957BTW, your solution is perfectly acceptable! Your branching (goto's) are perfect! (at least 4 me)If you want to run it from runonceex.cmd, you would:Rename the batch/cmd you posted as inst_ffd.cmdThen use something like this on your runonceex.cmd:cmdow @ /HID@echo offIF EXIST D:\CD.txt set CDROM=D:IF EXIST E:\CD.txt set CDROM=E:IF EXIST F:\CD.txt set CDROM=F:IF EXIST G:\CD.txt set CDROM=G:IF EXIST H:\CD.txt set CDROM=H:IF EXIST I:\CD.txt set CDROM=I:IF EXIST J:\CD.txt set CDROM=J:SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY% /V TITLE /D "Installing Applications" /fREG ADD %KEY%\001 /VE /D "Installing ffdshow..." /fREG ADD %KEY%\001 /V 1 /D "%CDROM%\Software\inst_ffdshow.cmd" /fEXIT Link to comment Share on other sites More sharing options...
midiboy Posted January 6, 2005 Author Share Posted January 6, 2005 Hi again, Shotgun,yeah well, in the meantime I found out that the problem is that CHCKCPU will not run from CDROM, at least that "findstring" code part won´t work there. I guess thats because it needs to write to a file to check for that string ?? Anyway, if I copy it to C: and run the script from there, it works so thats fine with me.I did add something similar to your code to my runonceex but thats not what I meant actually. I was asking if it is possible to add the whole code from the cmd to the runonceex, not just call the external cmd from the runonceex. But it is working now so thats not a big problem :-)I will try something similar for the Intel Chipset now .... Bye,Alex Link to comment Share on other sites More sharing options...
Shotgun Posted January 6, 2005 Share Posted January 6, 2005 eah well, in the meantime I found out that the problem is that CHCKCPU will not run from CDROM, at least that "findstring" code part won´t work there. I guess thats because it needs to write to a file to check for that string ??You need to copy FINDSTR.EXE to the CD too. It can be copied from the Winnt\system32 directory. Sorry I did not mention that before No file is written, the findstr reads the Output of the chkcpu command, by piping the output with the '|' character. Same thing for the second findstr. In others words, all string handling is done in the display buffer. The last > NUL makes sure the buffer is emptied (redirected to NULL device) so nothing is displayed to the screen. Try executing each part to see what I mean. ex: CHKCPU /Vthen... CHKCPU /V | FINDSTR "SSE2" ... etc.Also, you mentioned not being able to set the %CDROM% variable, how then you were able to run CHKCPU from the CD if the variable was NOT set to point to the CD? Please detail your answer since I'm confused by your comment. I'm assuming you are running everything from the CD and the system is completely 'blanked out' (no OS installed before you put the CD. BTW, what are you using for testing the CD install part? Virtual PC, VMWare, a 'test system'? I was asking if it is possible to add the whole code from the cmd to the runonceex, not just call the external cmd from the runonceex.Yes and No. You need to call the external cmd, and any other external cmd since it has GOTO statements and you can't use conditional branching in RunOnceEx (the registry key where all these commands are being written). It's easier to maintain in case you want to change the order apps are being installed, or if you substitute an app for another in the future. It would be a headache to edit a large runonceex.cmd file than a small file that only set the specific entries, and the "load" of the work gets done by individual cmd files for each app installed. Many files, but in the end easier to maintain. Please keep in mind that the file is called runonceex.cmd just to remind that this cmd file writes the RunOnceEx registry entries, the moment Windows Executes that registry key it is just executing the statements written by the cmd file, NOT the cmd file itself. If you execute the runonceex.cmd file from an MSDOS window, open Registry Editor (start->run->regedit) then check the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx to see what the cmd just wrote. This key is executed upon first logon, so what gets written there will be executed on the first logon, then dissapear. Windows executes the entries on this key, one by one. It's possible to include more than one line, but that would make the runonceex.cmd file more complex than it needs to be. Link to comment Share on other sites More sharing options...
midiboy Posted January 8, 2005 Author Share Posted January 8, 2005 HI again, Shotgun,took me a while to answer because I had to test this on a "non SSE2 capable" system first and I didn´t have one around ...Anyway, it did not work as expected on an old Athlon PC. This is because the script checks for "SSE2" and "No" but strangely enough, CHKCPU will not mention SSE2 at all if the processor does not even support SSE.So I had to change the script to make it look for SSE2 and Yes. That worked but only like this:@echo offFOR %%d IN (c: d: e: f: g: h: i: j: k: l: m: n: o: p: q: r: s: t: u: v: w: x: y: z:) DO IF EXIST %%d\AIO SET CDROM=%%d%CDROM%\SETUP\CHKCPU\CHKCPU.EXE /v | %CDROM%\SETUP\CHKCPU\findstr.exe "SSE2" | %CDROM%\SETUP\CHKCPU\findstr.exe "Yes" > NULrem echo %errorlevel%if not errorlevel 1 goto SSE2if errorlevel 1 goto NoSSE2:NoSSE2start %CDROM%\SETUP\ffdshow\ffdshow-20041012.exe /Sgoto end:SSE2start %CDROM%\SETUP\ffdshow\SSE2\ffdshow-20041012-sse2.exe /Sgoto end:endexitIt does NOT work if I check for errorlevel 0 instead of 1. Any idea why ?? I was also able to complete a working script for checking the Chipset. To be more exact I had to make sure that the Intel Chipset uses one of the 6 ICH Southbridges because the INTEL IDE driver only works for those chipsets. Older chipsets are not supported anymore with the latest Intel Chipset driver so my script which uses CPU-Z goes liike this:@echo off%SYSTEMDRIVE%\CPU-Z\cpuz -file=%SYSTEMDRIVE%\chipsatzfindstr /I Southbridge %SYSTEMDRIVE%\chipsatz.txt | findstr /I ich > NULecho %errorlevel% >> %SYSTEMDRIVE%\chipsatz.txtrem echo %errorlevel% if not errorlevel 1 goto ichif errorlevel 1 goto end:ichstart %SYSTEMDRIVE%\install\Intel\Setup.exe -INTELIDE -sgoto end:endexitThis has to be run from harddisc as CPU-Z needs to write a file. Of course I am in big trouble if findstr.exe suddenly outputs other errorlevels except 0 and 1 ! This won´t happen though, right ??? As for your last message, yes, I didn´t copy findstr.exe. Back then I didn´t even realize that this was a program I thought it was some kind of command like copy.Thanks for all your help ! Couldn´t have done it without you ! Bye,Alex Link to comment Share on other sites More sharing options...
Shotgun Posted January 8, 2005 Share Posted January 8, 2005 Check here for info on using FINDSTR.EXE. It does NOT work if I check for errorlevel 0 instead of 1. Any idea why ??I believe the last findstr sets errorlevel to 1 if the string is found. I'm not really sure if it returns errorlevel 0, after reading this: FIND.EXE Does Not Return the Proper Errorlevel in Windows NT Of course I am in big trouble if findstr.exe suddenly outputs other errorlevels except 0 and 1 ! This won´t happen though, right ???AFAIK, it only returns either 0 or 1. Glad to be of help! 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