Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!tymix!cirrusl!sunstorm!dhesi From: dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) Newsgroups: comp.lang.perl Subject: Re: Proposed enhancements to MS-DOS perl Message-ID: <2504@cirrusl.UUCP> Date: 26 Sep 90 02:03:53 GMT References: <1990Sep20.013320.9162@holos0.uucp> Sender: news@cirrusl.UUCP Organization: Cirrus Logic Inc. Lines: 47 In <1990Sep20.013320.9162@holos0.uucp> lbr@holos0.uucp (Len Reed) writes: > e) Handle "switch" character properly. (Currently > perl.exe will run "command /c the_command" instead of > "command -c the_command" when the switch character is a > hyphen instead of a slash. I'd like to warn all people who are trying to handle the MS-DOS "switch" character correctly. (Non-MS-DOS users may want to tune out. The MS-DOS "switch" character is one of Microsft's more interesting fiascos.) The "switch" character handling under MS-DOS runs roughly as follows: MS-DOS version Switch char handling -------------- -------------------- 1.x none 2.x documented, correctly handled 3.x undocumented; correctly handled by COMMAND.COM, CONFIG.SYS, and most utilities 4.x undocumented; unrecognized in CONFIG.SYS; correctly handled by no utilities (or almost none); recognized by parts of COMMAND.COM but mostly not. The real problem arises in MS-DOS 4.x, in which COMMAND.COM no longer accepts a /C or -C etc. depending upon the switchar. It always wants /C. So, if your program checks the switchar, finds it is "-", and uses "COMMAND -C", it will get an error message from COMMAND.COM. Thus, there are two possible ways of correctly handling the switchar value. (a) See what the switchar is, find out the MS-DOS version, and handle according to the above table. For MS-DOS versions 2.x and 3.x, use "COMMAND -C" if the switchar is "-". For MS-DOS version 4.x, always use "COMMAND /C". (b) Save the current switchar, set it to "/", and use "COMMAND /C". Then set it back to what it was. -- Rahul Dhesi UUCP: oliveb!cirrusl!dhesi