[net.micro] null as variable in batcg fileh file

2212msr@whuts.UUCP (ROBIN) (02/11/86)

Does anyone know how to detect a null as variable input in a batch file?
Specifically:

foo %1   --how do I detect case where %1 is omitted, thus avoiding
	   an error?  I've tried 'if %1=='':goto xx' as well as
==' '

rde@ukc.ac.uk (R.D.Eager) (02/12/86)

In article <533@whuts.UUCP> 2212msr@whuts.UUCP writes:
>Does anyone know how to detect a null as variable input in a batch file?
>Specifically:
>
>foo %1   --how do I detect case where %1 is omitted, thus avoiding
>	   an error?  I've tried 'if %1=='':goto xx' as well as
>==' '


I remember a way to do this from my version 6 days (ah, when life was simple..)

It works on MS-DOS 2.11 anyway!

     if %1x == x ......
-- 
           Bob Eager

           rde@ukc.UUCP
           rde@ukc
           ...!mcvax!ukc!rde

           Phone: +44 227 66822 ext 7589

nather@utastro.UUCP (Ed Nather) (02/12/86)

In article <533@whuts.UUCP>, 2212msr@whuts.UUCP (ROBIN) writes:
> Does anyone know how to detect a null as variable input in a batch file?
> Specifically:
> 
> foo %1   --how do I detect case where %1 is omitted, thus avoiding
> 	   an error?  I've tried 'if %1=='':goto xx' as well as
> ==' '

Try 

     if "%1" == ""

-- 
Ed Nather
Astronomy Dept, U of Texas @ Austin
{allegra,ihnp4}!{noao,ut-sally}!utastro!nather
nather@astro.UTEXAS.EDU