Path: utzoo!attcan!uunet!know!pluto.hemel.bull.co.uk!peterh From: peterh@hemel.bull.co.uk (Peter Holditch) Newsgroups: comp.os.msdos.misc Subject: Re: Getting rid of "syntax error" from .bat files - how to? Message-ID: <1990Dec7.141427.9976@hemel.bull.co.uk> Date: 7 Dec 90 14:14:27 GMT References: <9467@pasteur.Berkeley.EDU> Sender: @hemel.bull.co.uk Organization: Bull HN UK Lines: 35 Nntp-Posting-Host: brno brand@cad.Berkeley.EDU (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? >In addition, is there any way of passing a string, the first character >of which is a dash (-), as in -f? It doesn't seem to work with the >above test. >Cheers, >-Graham To supress the syntax error, use if "%1"=="param1" or if %1.==param1. as for passing strings starting with -, I have no problem on dos 3.20 Peter Holditch -- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # From: Peter.Holditch@hemel.bull.co.uk # # Tel: 0442-232222x4826 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #