Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.os.msdos.programmer FAQ part 4/5
Section - - How can a batch file tell whether it's being run in a DOS box under Windows?

( Part1 - Part2 - Part3 - Part4 - Part5 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Restaurant inspections ]


Top Document: comp.os.msdos.programmer FAQ part 4/5
Previous Document: - What's this 'null pointer assignment' after my C program executes?
Next Document: - How can my program tell if it's running under Windows?
See reader questions & answers on this topic! - Help others by sharing your knowledge
Date: 5 Feb 2002 22:03:03 -0400

 When Windows 3.0 or 3.1 is running, the DOS environment will contain a
 definition of the string windir, in lower case. That's not really
 useful, however, because the batch statement

  if "%windir%" == "" ...

 will test for an environment variable WINDIR in upper case.

 Your only real option is to write a program as suggested by the
 following question, and have it return a value which your batch file can
 test via "if errorlevel".

User Contributions:

1
Ben in Seattle
Jun 2, 2026 @ 4:16 pm
Another solution is to use a parallel port loopback plug. It makes the PC think there is a printer attached. The benefit of this is it doesn't require anticipating the problem with ANSI.SYS escape sequences nor does it make you wait half an hour for the "Abort, Retry, Ignore?" prompt, as some versions of DOS do.

Comment about this article, ask questions, or add new information about this topic:




Top Document: comp.os.msdos.programmer FAQ part 4/5
Previous Document: - What's this 'null pointer assignment' after my C program executes?
Next Document: - How can my program tell if it's running under Windows?

Part1 - Part2 - Part3 - Part4 - Part5 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
jeffrey@carlyle.org (Jeffrey Carlyle)





Last Update March 27 2014 @ 02:11 PM