I needed a way to let my AUTOEXEC.BAT detect things like whether or not I was connected to a network, whether my ZipDrive was connected, what server I was connected to, whether my PCMCIA card was in place... That's life as a road warrior. Lots of us have no idea what configuration our laptops are going to be in from hour to hour, and I, for one, got tired of seeing the unending parade of error messages as this or that driver failed to load or the printer in my home office didn't get captured. Or any of a dozen other easily forseen problems. Heck, it's only a batch file, but there should be a way to fix that... I was about to write a separate COM program. And then I saved myself the trouble. Take a look at the sample program here which is written to see if ANSI is available: mem /d | find "ANSI" > nul if not errorlevel 1 echo ANSI is in memory MEM is the command I'm interested in here. You could substitute virtually any command you wanted. The /D option generates an exhaustive list of everything in conventional memory. The entire list is then "piped" into the FIND command for searching. FIND generates a DOS error code on exit. If it finds something, the errorlevel is zero. If it can't find it, the errorlevel is one. If there was a problem, the errorlevel is two. By testing for ERRORLEVEL 1, I am actually testing for errorlevel 1 or greater (a quirk of DOS). By inverting it with NOT, I am effectively testing for zero exclusively. If you must test for a specific number of finds (for example, to look for the 3 instances of WIN in memory), you'll want to count things using CHOICE: mem /d | find /c "WIN" | choice /n /c:0123456789 > nul if errorlevel 4 echo This program is running under Windows FIND uses the /C option to "count" the occurences of the text string WIN in the MEM output listing. The text string, again, could be anything you wanted. The resulting number of occurences is then piped into CHOICE. CHOICE takes the first digit of the number supplied by FIND and compares it against the list following the /C: option. If the number is 0, CHOICE will return an errorlevel of 1 (since 0 is the first item in the list). If the number is 1, CHOICE will return an errorlevel of 2, and so on. The /N option insures CHOICE doesn't try to generate a prompt of it's own. The redirection of CHOICE into NUL stops the number we are discussing from being sent to the screen as well. IF tests the ERRORLEVEL and takes the appropriate action. Keep in mind that "if errorlevel 4" really means "if errorlevel is greater than or equal to 4". In this example, if Windows is running, we will FIND 3 instances of WIN (data, environment, and program). FIND would pipe the number 3 into CHOICE. Since 3 is the fourth item in the /C: list, the resultant errorlevel would be 4. The IF test would pass, since 4 is greater than or equal to 4. And yes, we would then be notified that Windows was most definitely running. A caution: always write this with the CHOICE /C: option having all 10 numbers (zero through nine), even if you're only expecting a zero or a one. Things could change, and any value not in the CHOICE list will lock CHOICE up. By including all 10 numbers, you prevent a lockup. FYI, the CHOICE command is not generally available under NT. You can get it on the disk version of the Resource Kit, but not on the download version. If you really want to implement this Win9x solution on NT, you can always steal a copy of CHOICE.EXE from a Win9x box. All reports I've heard say it works just fine. If a Win98 box isn't handy, download it: ftp://ftp.microsoft.com/Services/TechNet/samples/PS/Win98/Reskit/SCRPTING/