Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

switchar

6 views
Skip to first unread message

John Allen

unread,
Oct 27, 1986, 11:10:23 AM10/27/86
to
In article <1402@uw-june> ro...@uw-june.UUCP writes:
>What is "switchar"? I have stumbled across a couple of cryptic
>references to it and my curiosity is piqued. From what I was
>able to infer, it seems to be an environment variable in DOS that
>can be set to change the character used as a separator in pathnames.
>I tried it several ways but couldn't get it to work (DOS 3.2).
>I would like to be able to use the '/' character in any event.

There is an undocumented DOS function (sorry, I don't have it at hand)
which allows the switch character to be read or set. The switch character,
as the name implies, is used to delineate command line switches. The
default character is '/' under DOS. I like to use '-' instead, since
I'm likely to type that without thinking about it. Every DOS command,
Microsoft C, and many others seem to use the undocumented call to read
the switch character, or atleast accept the '-' that I like to use.

When the switch character is something other than a slash, Unix-like
path names may be used in almost all circumstances.

John Allen
=========================================================================
NetExpress Communications, Inc. seismo!{sundc|hadron}!netxcom!jallen
1953 Gallows Road, Suite 300 (703) 749-2238
Vienna, Va., 22180
=========================================================================

bill

unread,
Oct 27, 1986, 11:59:00 AM10/27/86
to

I've never used it, and Microsoft doesn't support it, but I can
tell you what it's for. By changing the switch character from "/" to "-",
DOS will allow Unix-style forward slashes in path names; you then have
to use the hyphen (dash) character, like Unix, to indicate command line
switches.

Changing the switch character may make things "friendlier" and more "Unix-
like" for you, but watch out. Any batch files you create probably won't
work on other people's machines; any that you acquire from elsewhere will
probably have to be modified to run on your machine. Also, you may run
into problems with applications that programmatically EXEC another file
(possibly passing command line switches) or with programs that parse
path names. Microsoft didn't document SWITCHAR because they didn't want
people to use it, since it can potentially add a lot of confusion.

bill frolik
hp-pcd!bill
Hewlett-Packard Portable Computer Division
Corvallis, Oregon

Bill Mayhew

unread,
Oct 28, 1986, 8:26:55 AM10/28/86
to

Hi,

You are correct that switchar seems to be broken in DOS 3.x.
Following is a brief batch file that you can run that uses debug to
to create a small .com file that allows you to set the switch
character at the prompt level in (seemingly) any version of DOS.
Be careful though, some programs are to dumb to realize that you've
changed the switchar, and will bomb when they call their overlays.

Bill Mayhew: (w...@neoucom.UUCP ...!cbatt!neoucom!wtm)

------------------------previous article-----------------------

>From f...@well.UUCP Wed May 28 01:33:54 1986
>Newsgroups: net.micro
>Subject: Re: Changing SWITCHAR in dos 3.x
>
>In article <8...@brl-smoke.ARPA> bri...@RAND-UNIX.arpa writes:
>>The MS-DOS COMMAND.COM shell uses the forward slash '/'
>>as its SWITCHAR to designate command-line parameters.
>>In dos versions 2.x the following line could be added
>>to the CONFIG.SYS file to change that character to a '-',
>>allowing the '/' to be used as a separator for directory
>>names in a path:
>> SWITCHAR=-
>>This doesn't work for dos 3.1. Is there another way to do it?
>
>I've posted this program a couple of times, but never this way before.
>Save the following as SW.BAT:
>-----
goto END
e 100 F6 06 80 00 FF 74 09 8A 16 82 00 B8 01 37 CD 21
e 110 B8 00 37 CD 21 88 16 30 01 BA 22 01 B4 09 CD 21
e 120 CD 20 53 77 69 74 63 68 20 63 68 61 72 20 3D 20
e 130 00 0D 0A 24
rcx
34
n switch.com
w
q
:END
debug <sw.bat
>-----
>SWITCH will tell you what the current switch character is, while
>SWITCH c will set the switch character to c.
>--
>Frank Whaley
>EFS Management Software, Inc.

Don Kneller%Langridge

unread,
Oct 29, 1986, 8:11:28 PM10/29/86
to
In article <1...@netxcom.UUCP> jal...@netxcom.UUCP (John Allen) writes:
>In article <1402@uw-june> ro...@uw-june.UUCP writes:
>>What is "switchar"? I have stumbled across a couple of cryptic
>>references to it and my curiosity is piqued.
>
>The switch character,
>as the name implies, is used to delineate command line switches. The
>default character is '/' under DOS. I like to use '-' instead, since
>I'm likely to type that without thinking about it. Every DOS command,
>Microsoft C, and many others seem to use the undocumented call to read
>the switch character, or atleast accept the '-' that I like to use.

Be careful though. LINK and LIB don't use switchar, relying on / only.
Also, when switchar is -, for COMMAND.COM you *must* give the path to
executable files with /; \ won't work anymore. Eg. \bin\cl is now /bin/cl.
The above applies for DOS 3.1
--
Don Kneller
UUCP: ...ucbvax!ucsfcgl!kneller
ARPA: kne...@cgl.ucsf.edu
BITNET: kne...@ucsfcgl.BITNET

Guido van Rossum

unread,
Nov 1, 1986, 11:47:53 AM11/1/86
to rnews@mcvax
In article <1520...@hpcvlo.UUCP> bi...@hp-pcd.UUCP (bill frolik) writes:
>Microsoft didn't document SWITCHAR because they didn't want
>people to use it, since it can potentially add a lot of confusion.

Yeah, the real question is, why did they add the code in the first
place? Sounds like somebody working on the code added it without
approval. An alternative theory is that when MS-DOS 2.0 was first
created, they weren't so sure that they were right in making / the
option characer and \ the filename separator, and added some Trojan
horse to their own software so that at a later time they could switch
and people with old copies of MS-DOS would be able to use new software
without getting a new copy of MS-DOS. Obviously, the switch never came,
so maybe it should be removed from MS-DOS 3.0 (or has it already been
removed?).

Incidentally, the file system always accepts both / and \ in file names;
it's only the shell (COMMAND.COM) and some applications that don't grok
/ in file names because it is always seen as an option, even in the
middle of a word!
--
Guido van Rossum, CWI, Amsterdam <gu...@mcvax.uucp>

Doug Landauer

unread,
Nov 6, 1986, 10:03:06 PM11/6/86
to
In article <1520...@hpcvlo.UUCP> bi...@hp-pcd.UUCP (bill frolik) writes:
>Microsoft didn't document SWITCHAR because they didn't want
>people to use it, since it can potentially add a lot of confusion.

In article <71...@boring.mcvax.UUCP> guido@boring (Guido van Rossum) writes:
>Yeah, the real question is, why did they add the code in the first
>place? Sounds like somebody working on the code added it without
>approval.

My guess (total speculation, since I don't know anyone who was involved):

Microsoft had some people familiar with Unix, and when they got DOS-86 (or
whatever it was called) from SCP, they wanted to start adding Unix features
to the system. They wanted to add a Unix-like hierarchical file system, but
DOS-86 already used "/" for the command switches. (DOS-86 used "/" because
CP/M did; CP/M used it because of the DEC systems (RT11?) that Kildall had
used when he developed CP/M.)

So they added SWITCHAR so that they could use "/" for the filename separator
without provoking the wrath of the marketing people who thought that MS-DOS
had to retain its command-level similarity to CP/M.

Why the awful choice of backslash (with a different location on every
different keyboard) was made, I'll never know (unless anyone at Microsoft is
listening and would like to correct me. (Except, I don't think they're
allowed to post news.)) Why not hyphen, semicolon or comma?

>Obviously, the switch never came, so maybe it should be removed from MS-DOS
>3.0 (or has it already been removed?).

The "SWITCHAR=?" option in CONFIG.SYS doesn't work in PC-DOS 3.XX,
but the system call (INT 21/Function ??) still works.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Anyway, It's clear that this whole problem is primarily DEC's fault, for
being so slow to recognize Unix' benefits, and for hanging on to their
"rainbow" of PDP11 operating systems instead of jumping on the Unix
bandwagon ten or twelve years ago when it was only a rubber-band wagon.
:-)
--
Doug Landauer Sun's Net: landauer@morocco
Phone: 415 691-7655 ARPANET (aka DDN): land...@sun.com
UUCP: {amdahl, decwrl, hplabs, seismo, ...}!sun!landauer

0 new messages