1:\ Posted code in wrong language, the poster wrote this in VBS - No argument, you are the VBS expert, not me. I just posted the logic of what is recommended to test for, a Batch script command to accomplish that, a link to another discussion about this issue, and a link to an MSDN blog - David Wang at MS - which explains the reasoning behind the recommended solution.
3:\ Microsoft you keep saying that, but you have not provided any links to support what you claim. - Link to MSDN blog was indirectly posted in post #8. The link was available in the discussion thread I linked to here. The link was given in that thread at least three times and the code was also copied from there into the thread. In case folks didn't want to read the full discussion to get the actual MSDN blog link, I then posted the actual MSDN blog link in post #10, and again above, and I'll post it yet again here for your convenience - David Wang at MS. I don't know if David is still with MS or not, but he was part of the MS IIS team for at least five years and blogged at http://blogs.msdn.com from 2004 - 2008. Then on top of that, I posted a copy of almost the entire blog post in post #10 in case people didn't even want to bother going to the MSDN site to read it for themselves. I don't know how much more I need to post to "support what I claim".
It also ends up that this same logic is implemented in the Windows Assessment and Deployment Kit (ADK) for Windows 8/WinPE 4.0. Microsoft Example in ..\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\DandISetEnv.cmd:
@Echo off REM REM Sets the PROCESSOR_ARCHITECTURE according to native platform for x86 and x64. REM IF /I %PROCESSOR_ARCHITECTURE%==x86 ( IF NOT "%PROCESSOR_ARCHITEW6432%"=="" ( SET PROCESSOR_ARCHITECTURE=%PROCESSOR_ARCHITEW6432% ) ) ELSE IF /I NOT %PROCESSOR_ARCHITECTURE%==amd64 ( @echo Not implemented for PROCESSOR_ARCHITECTURE of %PROCESSOR_ARCHITECTURE%. @echo Using "%ProgramFiles%" SET NewPath="%ProgramFiles%" goto SetPath )
5:\ Yzöwl provided a Cmd script, of VBS from what I read the most accurate way to get OS bit - Yzöwl posted an alternative Cmd script in post #18 that implements the same logic that David Wang recommends:
Using that logic then the following should suffice:ECHO=%PROCESSOR_ARCHITECTURE%' %PROCESSOR_ARCHITEW6432%'|FIND "64'">NUL 2>&1&&ECHO=[64bit]||ECHO=[x86]
Ricktendo, vmanda, mr_smartepants, OnePiece, 5eraph, gora, dumpydooby, ELiTE, and others were all involved in the discussion referenced above. You, and the OP, are welcome to use whatever code works best for you. I just don't know why you keep saying that I am wrong. I did not create the code.
Cheers and Regards