:: Selective_OS_Example.cmd :: :: - by Nick @ FoolishIT.com [Foolish IT LLC] :: - Official Download: https://download.foolishit.com/BatchFiles/Selective_OS_Example.cmd.txt :: :: set echo off and change to the current directory. @echo off&pushd "%~dp0" :: Common code can go here :: Check Windows Version ver | findstr /i "6\.0\." > nul IF %ERRORLEVEL% EQU 0 goto Vista ver | findstr /i "6\.1\." > nul IF %ERRORLEVEL% EQU 0 goto Win7 :: Windows XP Code goes here if exist "%programfiles% (x86)" ( echo Do code for XP 64bit ) else ( echo Do code for XP 32bit ) goto :end :Vista :: Windows Vista Code goes here if exist "%programfiles% (x86)" ( echo Do code for Vista 64bit ) else ( echo Do code for Vista 32bit ) goto :end :Win7 :: Windows 7 Code goes here if exist "%programfiles% (x86)" ( echo Do code for 7 64bit ) else ( echo Do code for 7 32bit ) :end :: More common code can go below here - remove the pause statement below to exit without pause. pause