@goto _beg The dos set command always converts variables to uppercase. The 3.x and 9x windir and winbootdir are lowercase variables. The set command cannot change them b/c they are lowercase, therefore, if these still exist, then they were set by the Windows OS, and decisions can be made based on this concept. Sean Blankenship :_beg @echo off :_set :: use the lowercase trick to clear any chance of :: existing variables. set windir= set windbootdir= :_mod :: winNT is explicit and obvious if [%OS%]==[Windows_NT] goto _nt :: dos does not have windir but win3x does if [%windir%]==[] goto _dos :: win3x has windir but not winbootdir if [%winbootdir%]==[] goto _3x :: if winbootdir exists, it must be either 9x or NT :: we have already checked for NT goto _9x :_dos set xOS=DOS goto _rep :_3x set xOS=3x goto _rep :_9x set xOS=9x goto _rep :_nt :: may be able to check for 2k variables like system root :: or system drive, etc... if exist "c:\documents and settings\" set XOS=2k if not exist "c:\documents and settings\" set XOS=40 goto _rep :_rep :: return XOS echo Running OS: %xOS% goto _end :_end