Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!helios.physics.utoronto.ca!ists!yunexus!xrtll!silver From: silver@xrtll.uucp (Hi Ho Silver) Newsgroups: comp.os.msdos.misc Subject: Re: Getting rid of "syntax error" from .bat files - how to? Message-ID: <1990Dec10.023128.21316@xrtll.uucp> Date: 10 Dec 90 02:31:28 GMT References: <9467@pasteur.Berkeley.EDU> Reply-To: silver@8xrtll.UUCP (Hi Ho Silver) Organization: Not around here, pal! Lines: 24 In article <9467@pasteur.Berkeley.EDU> brand@cad.Berkeley.EDU.UUCP (Graham Brand) writes: $I have written a batch file which accepts parameters from the command $line using the: $ if %1==param1 $syntax. It works fine except that if I don't pass any parameters, I $get the above syntax error message. Is there any way to suppress this? Yup. The reason, incidentally, that the above doesn't work is that it expands to if ==param1 which is incorrect. So all you need to do is add a constant character to both sides of the expression; for example, if _%1==_param1 (pick your favourite character, as long as it has no special meaning to the shell). -- __ __ _ | ...!nexus.yorku.edu!xrtll!silver | always (__ | | | | |_ |_) >----------------------------------< searching __) | |_ \/ |__ | \ | if you don't like my posts, type | for _____________________/ find / -print|xargs cat|compress | SNTF