Message-ID: <3B3CADA3.4000506@earthlink.net> Date: Fri, 29 Jun 2001 11:32:35 -0500 From: Jonathon Merz User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.1) Gecko/20010607 X-Accept-Language: en,pdf MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Incorrect resolution of COMSPEC environment variable on WinNT Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Is this a bug or am I missing something? With the following code: main() { char *comspec_value = getenv("COMSPEC"); printf("%s\n", comspec_value); } When compiled with DJGPP's gcc on WinNT 4, the output is: C:\WINNT\SYSTEM32\COMMAND.COM The trouble is that on NT 4, (and I have verified this in my shell) COMSPEC is set to c:\winnt\system32\cmd.exe. The correct value is output when compiled under several other compilers. If anyone sees a mistake, or if it is a bug, knows of a workaround for this, I'd love to hear it. Alternatively, (This may be a newbie question, but I can't find any info in the docs on this) if there is a way to identify the operating system the program is running under, then I suppose I could hardcode in cmd.exe on WinNT. Thanks in advance, -Jon