🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc
Article #40554

Why is comma delimiter in batch files?

#40554
From: roger.h.levy
Date: Mon, 01 Jan 1990 23:13
37 lines
1248 bytes
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:

main(argc, argv)
int	argc;
char	**argv;
{
	while (--argc)
		printf("%s\n", *++argv);
}

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:

echo off
:start
if x.%1 == x. goto exit
echo %1
shift
goto start
:exit
echo on

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?

Roger H. Levy
Bell Labs, Whippany NJ
att!groucho!rl
Technical Details
Message-ID: <3445@cbnewsl.ATT.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!cbnewsl!rl

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!cbnewsl!rl
From: rl@cbnewsl.ATT.COM (roger.h.levy)
Newsgroups: comp.sys.ibm.pc
Subject: Why is comma delimiter in batch files?
Keywords: batch MSDOS
Message-ID: <3445@cbnewsl.ATT.COM>
Date: 1 Jan 90 23:13:29 GMT
Organization: AT&T Bell Laboratories
Lines: 37