Message-ID: <000401c16010$56853c00$027efea9@atlantis> From: "Matthias Paul" To: References: <200110281713 DOT f9SHD1dL010993 AT eos DOT arc DOT nasa DOT gov> Subject: Re: path separater? Date: Mon, 29 Oct 2001 01:22:08 +0100 Organization: University of Technology, RWTH Aachen, Germany MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id f9T0QaE26445 Reply-To: opendos AT delorie DOT com On 2001-10-28 Jim Stevenson asked: > Is it possible in any dos to change the path separater from > \ to / as it is in linux? It happened that I answered this questions just a couple of days ago (2001-10-25) in the in alt.msdos.programmer and comp.os.msdos.programmer newsgroups under the subject "Re: Change \ to / in DOS". Hence I take the freedom to just forward my answer to this forum: > On 2001-10-22, Michael J. Vincent asked: > >> I came upon a piece of freeware code which enabled swapping the "\" >> directory symbol in DOS to "/" which would emulate UNIX like directory >> symbols. It had something to do with changing the escape character for >> command line switches from the "/" to the "-". Does this sound familiar >> to anyone? > > What you mean is the so called "SwitChar" API. You cannot directly > control the so called "path character" (´\´ under DOS and ´/´ under > Unix), but by controlling the SwitChar, you can indirectly influence > the use of the path character. > > Here´s some info which replaces the partially faulty info in RBIL61 > (will most probably have been corrected with RBIL62)... > > ------------------------------------------------------------ > INT 21 - DOS 2+ - "SWITCHAR" - GET SWITCH CHARACTER > AX = 3700h > Return: AL = status > 00h successful > DL = current switch character > FFh unsupported subfunction > Desc: Determine the character which is used to introduce command switches. > This setting is ignored by MS-DOS commands in version 4.0 and higher, > but is honored by many third-party programs and by Novell DOS 7 > external commands > Notes: documented in some OEM versions of some releases of DOS supported > by OS/2 compatibility box always returns AL=00h/DL=2Fh ('/') for > MS-DOS 5+ and CCI Multiuser DOS 7.xx. > However, this function is fully supported by DR DOS 3.41 - 7.05, > including DR PalmDOS, Novell DOS, and OpenDOS, and also by > S/DOS 1.0+ and PTS-DOS 6.51+, all reporting the current SwitChar > as set by INT 21h/3701h. The default SwitChar is 2Fh ('/'). > DR DOS 5.0+ COMMAND.COM (and NETWARE.COM) indicates switch > characters other than '/' by changing the first backslash (and > only the first one) > in the path it prints for CHDIR/CD and PROMPT $p with a forward slash. > DR-OpenDOS 7.02+ COMMAND.COM has a new pseudo environment variable > %/% added, representing the current SwitChar setting in batchjobs. > Most external commands fully honor the SwitChar. > A future (post DR-DOS 7.03) COMMAND.COM will probably also provide > a new PROMPT $/ token and external commands should honor an > environment variable named %SWITCHAR%, overriding the SwitChar > setting returned from this function. > Because of all the implementation differences it is recommended > to preset DL = 2Fh when calling this function. > ------------------------------------------------------------ > INT 21 - DOS 2+ - "SWITCHAR" - SET SWITCH CHARACTER > AX = 3701h > DL = new switch character > Return: AL = status > 00h successful > FFh unsupported subfunction > Notes: documented in some OEM versions of some releases of DOS; DOS 2.x > had a SWITCHAR=c setting in CONFIG.SYS > supported by OS/2 compatibility box and Novell DOS 7 > ignored by MS-DOS 5+ and CCI Multiuser DOS 7.xx (and probably > all the other OS from the DR Multiuser DOS family) > Although DR DOS 6.0 (probably earlier???) - 7.05 leave AX > unchanged, this function is otherwise fully supported by > DR DOS 3.41 - 7.05, including DR PalmDOS, Novell DOS, and > OpenDOS, and will actually change the SwitChar setting. > This holds true also for S/DOS 1.0+ and PTS-DOS 6.51+. > DR-OpenDOS 7.02 - DR-DOS 7.05 as well as S/DOS 1.0+ and > PTS-DOS 6.51+ were enhanced to also support a SWITCHAR= > directive in CONFIG.SYS (accepting only '/' or '-'). > ------------------------------------------------------------ > > A few more notes: > > FreeDOS also supports the SwitChar API and a CONFIG.SYS directive > SWITCHAR=c. JPSoft´s 4DOS command processor has a (sometimes > undocumented) SETDOS /Wc command to set the current SwitChar to c. > In the list displayed by SETDOS the current SwitChar occurs as > SWITCH=c (this, %/%, and the $p special case mentioned above can > be used to evaluate the SwitChar from within batchjobs without > 3rd party tools - see MPDOSTIP.ZIP on my site for an example). > > Since the API is not actually operational under MS-DOS/PC DOS you > will need a small (trivial) TSR which sits on top of this API and > allows to change the current setting. An example for such a TSR > can be found on Ralf Brown´s site as example for writing AMIS > conformat drivers, it´s called SWITCHAR.COM. > > Regardless of the proper operation of, and the current SwitChar > setting as is, the DOS kernel itself will always accept ´/´ and > ´\´ in filespecs! > However, many filespec crunching routines in applications and > libraries only sense for ´\´, so not all applications accept the > ´/´ (in particular not in the command line where it might get > confused with the SwitChar if the code does not take this into > account). > Also, not all executables retrieve the current SwitChar setting > using this API (they really should - in all DOS issues up to the > present!), but work with hardwired ´/´ and/or ´-´ switch characters > instead and thereby make the API pretty much useless when you have > to use such executables. > > Hence my suggestion to all DOS programmers: Please don´t forget > to support this really trivial API to retrieve the current SwitChar > setting in your applications and thereby make life easier for those > of us who have to switch between DOS and Unix. :-) In regard to your other question, Jim: > Is there a way to make cd bring you up to the root? Try: CD \ or CD\ This will move you to the root of the current drive. If you want to change the current directory of a drive, which is not the current drive, try: CD d:\ See CD /? or DOSBOOK CD for help. Greetings, Matthias -- Matthias Paul, Ubierstrasse 28, D-50321 Bruehl, Germany ; http://www.uni-bonn.de/~uzs180/mpdokeng.html; http://mpaul.drdos.org