🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.pc
Article #5456

Re: null as variable in batch file

#5456
From: Kim DeVaughn
Date: Wed, 12 Feb 1986 11:56
25 lines
1269 bytes
[ ... go ahead, eat my bits ... ]

> 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
> ==' '

Hmmm ... I should probably try this out first, but my MS-DOS machine is
unavailable right now.  I *think* this will do what you want:

                   if .%1 == . goto xx

Note the "dots".  Also, I pretty sure that this will work too:

		   if "%1" == "" goto xx

/kim

-- 

UUCP:  {decvax,ucbvax,ihnp4}!decwrl!mips!kim
DDD:   415-960-1200
USPS:  MIPS Computer Systems Inc,  1330 Charleston Rd,  Mt View, CA 94043
Technical Details
Message-ID: <330@mips.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!linus!decvax!decwrl!glacier!mips!kim
References: <533@whuts.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site mips.UUCP
Path: arc1-ca.pugleaf.net!utzoo!linus!decvax!decwrl!glacier!mips!kim
From: kim@mips.UUCP (Kim DeVaughn)
Newsgroups: net.micro.pc,net.micro
Subject: Re: null as variable in batch file
Message-ID: <330@mips.UUCP>
Date: Wed, 12-Feb-86 06:56:52 EST
Article-I.D.: mips.330
Posted: Wed Feb 12 06:56:52 1986
Date-Received: Fri, 14-Feb-86 06:01:41 EST
References: <533@whuts.UUCP>
Distribution: net
Organization: mips ... where RISC is a way of life
Lines: 25