[comp.sys.ibm.pc] How to change DOS "\" to "/"

mrwittma@phoenix.Princeton.EDU (Martin R. Wittmann) (01/30/89)

I read one can change the DOS path separator, "\", to "/", allowing
(easier typing and) "-" to be used for DOS command options, but I didn't
read how.  Could someone please email me the standard response?

Thanks,					martin wittmann

kcallis@pnet02.cts.com (Kim C. Callis) (01/30/89)

I am also interested in info on how to change the seperator.

Kim Callis
K. Callis
UUCP: {ames!elroy, <backbone>}!gryphon!pnet02!kcallis
INET: kcallis@pnet02.cts.com

gfk@bridge2.3Com.Com (Gregory Kendall) (01/31/89)

In article <5927@phoenix.Princeton.EDU> mrwittma@phoenix.Princeton.EDU (Martin R. Wittmann) writes:

Stuff deleted about how to change '\' to '/' in DOS pathname ...

And, if anyone knows how to do this, would you please post it to the net, also?

nelson@sun.soe.clarkson.edu (Russ Nelson) (01/31/89)

begin 644 switchar.com
MNX``B@^`^0!T$D/^R8H7@/H@=/&P`;0WS2'-(+HV`;0)S2&P`+0WS2&T`LTA]
CM`FZ3`'-(<T@4W=I=&-H(&-H87)A8W1E<B!I<R`B)"(-"B2P-
``
end
--
--russ (nelson@clutx [.bitnet | .clarkson.edu])
"I saved the whales!" - Rebecca L. Nelson, 3.5 years old, on receiving her
Christmas present of a whale "adoption" certificate.  Bless her liberal heart.

murphys@cod.NOSC.MIL (Steven P. Murphy) (02/01/89)

I saw a binary of switch.com posted so here is a source for those interested.




        name  SWITCH
        title  switch char exchange program
        page    80,132

;******************************************************************************
;
;  title:   switch.asm
;
;  abstract:  this program is to change MSDOS's switch char to something
;             besides / (usually -)
;
;
;
;  author:   Steven Murphy    [murphys@nosc.cod.mil]
;            Naval Ocean Systems Center
;            Code 911
;            San Diego, CA 92152-5000
;            (619) 533-2216
;
;..............................................................................
;
;                    l o c a l   c o n s t a n t s
;
;******************************************************************************

;   ms-dos interrupts

msdos   equ  21h             ;  msdos

;   ms-dos functions

prtstr  equ   09h            ;  dos print string function ($ - treminated)
exitfun equ   4ch            ;  dos terminate program function

;   miscellaneous

cr      equ   0dh            ;  ascii carriage return
lf      equ   0ah            ;  ascii linefeed
bell    equ   07h            ;  ascii bell

;******************************************************************************
;
;              c o d e   s e g m e n t   d e f i n i t i o n
;
;******************************************************************************

prgname   segment  public   'code'
     assume    cs:prgname, ds:prgname, es:prgname, ss:prgname


     org  100h


;******************************************************************************
;
;                  m o d u l e   e n t r y   p o i n t
;
;   the following msdos '.com' entry conditions apply:
;    cs = ds = es = ss = loaded location
;
;******************************************************************************

main proc near

     jmp start               ; jump around data area

;******************************************************************************
;
;                    m o d u l e   d a t a   a r e a
;
;******************************************************************************
;   console messages

signon  db     cr,lf
        db     '    Switch  char',cr,lf
        db     cr,lf,'$'

msg1    db     'is ','$'
;******************************************************************************
;
;                     s t a r t   o f   p r o g r a m
;
;******************************************************************************

start:

;   send signon message to console

        mov   dx,offset signon
        mov   ah,prtstr                ; select the print string function
        int   msdos                    ; do it


        xor     cx,cx                  ; zero cx
        mov     si,0080h               ; point to command tail
        mov     cl,[si]                ; check for space before new switch char
        and     cl,cl                  ; set the flags for jz
        jz      loop2                  ; no space
        mov     si,0081h               ; there was a space so get char
loop1:
        mov     dl,[si]                ; get the new switch char
        cmp     dl,3fh                 ; is it a '?'
        jz      loop2                  ; yes, display the current char
        cmp     dl,20h                 ; is it above the control chars
        jg      loop3                  ; if yes make it the new char
        inc     si                     ; if no look again
        loop    loop1
loop2:
        mov     dx,offset msg1         ; print msg1
        mov     ah,prtstr              ;
        int     msdos
        mov     ah,37h                 ; switch char function
				       ; (al = 0  read, al = 1  write)
        xor     dl,dl                  ; clear dl
        xor     al,al                  ; clear al
        int     msdos
        mov     ah,02h                 ; display dl
        int     msdos
        mov     dl,cr                  ; print carrage return line feed
        int     msdos                  ;
        mov     dl,lf                  ;
        int     msdos                  ;
        jmp     short exit
loop3:
        mov     ah,37h                 ; write the switch char
        mov     al,01h                 ;
        int     msdos
        jmp     short loop2            ; display the switch char

exit:   mov   ah,exitfun               ; 4ch recomended
        mov   al,00h                   ; error code (0 - normal end)
        int   msdos                    ; exit to ms-dos


main    endp


prgname ends

        end   main

mdfreed@ziebmef.uucp (Mark Freedman) (02/04/89)

In article <5927@phoenix.Princeton.EDU> mrwittma@phoenix.Princeton.EDU (Martin R. Wittmann) writes:
>I read one can change the DOS path separator, "\", to "/", allowing
>(easier typing and) "-" to be used for DOS command options, but I didn't
>read how.  Could someone please email me the standard response?
>
>Thanks,					martin wittmann


   (there were several requests, including one to post rather than E-mail)
   I believe that you want the undocumented MS-DOS "switch char"
function. Changing this CAN cause problems, as many DOS commands
simply become confused (e.g. format a: -v doesn't work, while
DIR c:/dos -w  produces a wide listing of the subdirectory).
 
   BRAVO Microsoft !!! :-) 
 
/*  ==============   SW_CHAR.C  =========================== */
 
/*  tested with PC-DOS 3.2, Turbo C 2.0 */
 
/** Change MS-DOS Switch char via int 0x21 function 0x37  ***/
/*   usage:   sw_char x        (x is the new switch char)   */
/*                                                          */
/*    N.B. 0x37 is "undocumented" and may cause problems    */
/*         some DOS commands won't work with the new switch */
/*         DIR seems to (e.g. DIR c:/dos -w   works)        */
 
#include "dos.h"
#include "stdio.h"
 
void print_usage();
 
void main (int argc, char *argv[])
{
char old_switch, *new_switch;
 
   if (argc == 2)
      {
      new_switch = argv[1];
      if (strlen (new_switch) != 1)
         {
         print_usage();
         return;
         }
      }
   else
      {
      print_usage();
      return;
      }
 
/* al = 0 (get switch char);   switch char returned in dl */
 
   bdos(0x37, 0, 0);
   old_switch = (char) _DL;
   fputs ("\nold switch char is ", stderr);
   fputc (old_switch, stderr);
 
/* al = 1 (set switch char); dl contains new character */
 
   bdos (0x37, *new_switch, 1);
 
/* al = 0 (get switch char);   switch char returned in dl */
 
   bdos(0x37, 0, 0);
   old_switch = (char) _DL;
   fputs ("\nnew switch char is ", stderr);
   fputc (old_switch, stderr);
   fputs ("\n", stderr);
 
}
 
void print_usage()
{
   fputs ("\nUsage: sw_char x", stderr);
   fputs ("\n       where x is the new switch character", stderr);
   fputs ("\n", stderr);
   return;
}

nelson@sun.soe.clarkson.edu (Russ Nelson) (02/08/89)

In article <1989Feb4.105803.26039@ziebmef.uucp> mdfreed@ziebmef.uucp (Mark Freedman) writes:

      I believe that you want the undocumented MS-DOS "switch char" function.

Sigh.  I guess I have to make my offer again.  I will send a photocopy of the
page out of the Zenith PUP (Programmer's Utility Package) that DOCUMENTS the
use of the switchar function to anyone who sends me a SASE.  That's:
	Russell Nelson
	Clarkson University ECS
	Potsdam, NY 13676

[multi-line C program deleted]

Of course, you could always use setswitchar() and getswitchar(), which are
included in Turbo C.  At least, they were in 1.0 and 1.5...
--
--russ (nelson@clutx [.bitnet | .clarkson.edu])
"I saved the whales!" - Rebecca L. Nelson, 3.5 years old, on receiving her
Christmas present of a whale "adoption" certificate.  Bless her liberal heart.