Message-ID: <3B3CD4FB.2050300@earthlink.net> Date: Fri, 29 Jun 2001 14:20:27 -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: Re: Incorrect resolution of COMSPEC environment variable on WinNT References: <3B3CADA3 DOT 4000506 AT earthlink DOT net> <6923-Fri29Jun2001215309+0300-eliz AT is DOT elta DOT co DOT il> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > However, why is this a problem in your case? DOS programs in general > and DJGPP programs in particular should not normally care about this. My trouble is that I'm doing some small work on the Vim editor, improving the DOS/Windows installer for it. For Windows versions, we make a call to regedit.exe to add a context menu entry for Vim via a generated .reg file. I realize that it is strange to be using DJGPP to generate Windows executables, but in the interest of keeping things uniform, I am trying to keep the installer functioning the same way for all builds that will run on a Windows OS, even if they are technically DOS builds. The trouble is that with a system("regedit ... "), regedit executes asynchronously, so we cannot know when it has completed, thus, it is unsafe to delete the .reg file. As a way around this, with most of the compiler platforms Vim builds on, we can make the line system("start /wait regedit ..."), so that the installer does not regain control until regedit has finished, then we can delete the file. That works fine on Win9x, ME, and 2000, where there is a start.exe executable that does that. On WinNT, though, it turns out that start is a shell built-in for cmd.exe, but is not in command.com, thus the trouble. > >>if there is a way to identify the operating system the program is >>running under >> > > It's not easy. For example, there's no easy way we know of to > distinguish NT from Windows 2000. But if you don't care about the > difference, call _get_dos_version(1), and if it returns the version > 5.50, you are on NT. > That could work satisfactorily I think. Windows 2000 should have a cmd.exe also, so calling cmd.exe explicitly shouldn't cause any headaches. Thanks! -Jon