Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!rice!uw-beaver!zephyr.ens.tek.com!tektronix!psueea!parsely!bucket!leonard From: leonard@bucket.UUCP (Leonard Erickson) Newsgroups: comp.sys.ibm.pc Subject: Re: Why is comma delimiter in batch files? Keywords: batch MSDOS Message-ID: <1885@bucket.UUCP> Date: 2 Jan 90 21:47:02 GMT References: <3445@cbnewsl.ATT.COM> Organization: Rick's Home-Grown UNIX; Portland, OR. Lines: 37 rl@cbnewsl.ATT.COM (roger.h.levy) writes: >I've noticed that batch files regard both blanks and commas as delimiters >whereas c programs regard only blanks as a delimeter (If it matters, I'm >using DOS 3.2). For example: [example c program and comments deleted] >When this program is fed a parameter string of "one,two", it prints that >string back exactly, i.e. it regards the string as a single parameter. >However, when the following batch file is fed the same string: [example batch file and comments deleted] >It prints "one" and "two" on different lines, i.e. it regards a comma >delimited string as multiple parameters. >My question: Is there a way to convince batch files to think of the comma >as part of the parameter, i.e. to regard only blanks as delimiters so as >to be consistent with c programs? In a word, no. Batch files use COMMAND.COM. But it's (and MS-DOS's) rules spacem, comma, and semi-colon are all delimiters. This behavior is *defined* in the DOS manuals, so I'm afraid your out of luck. I wouldn't go that far but a case could be made that under MS-DOS, your C is showing the broken behaviour. I'm rather puzzled as to why you'd care that a C program abd a batch file have different behavior anyway. But since you do, you'd have to re-write *at least* COMMAND.COM. Possibly more. -- Leonard Erickson ...!tektronix!reed!percival!bucket!leonard CIS: [70465,203] "I'm all in favor of keeping dangerous weapons out of the hands of fools. Let's start with typewriters." -- Solomon Short