🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.misc
Article #3947

Re: In batch files, how to eval a variable?

#3947
From: Anderson
Date: Tue, 03 Oct 1995 00:00
27 lines
1682 bytes
koala@sydney.DIALix.oz.au (John Savage) wrote:

>I know MSDOS is rudimentary, but I try to get the most out of it ...

>When I give a .BAT file an argument which is the name of an environment
>variable, it would often be useful to be able to determine the value of
>that variable within the batch script. Unix provides this with the EVAL
>function, but in DOS I can't do it without writing to a file (or passing
>the value in as a second argument).

>e.g.,  SET I=45
>       CALL FF1 I

>       { in FF1, %1 has the value of I, but
>         I would like to use something like
>         %(%1)% and have it evaluate to 45  }

>Has anyone discovered a nifty way to do this using pure MSDOS and
>without writing to, then executing, a second batch file?
>--
>John Savage               koala@sydney.dialix.com.au

Are you trying to set I and have FF1 use 45, or do you just want to
use 45 in FF1.  If you just want to use 45 couldn't just use %1 in the
batch file, of what about the IF %1==I THEN command?

Skeleton Jack                 anderson@cnw.com
Technical Details
Message-ID: <44s38r$7nf@lassen.cnw.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <44e13f$gka$1@sydney.DIALix.oz.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d683,6193436daef3f8c5
X-Google-Attributes: gid10d683,public
X-Google-Thread: f53ba,6193436daef3f8c5
X-Google-Attributes: gidf53ba,public
X-Google-Thread: f71eb,6193436daef3f8c5
X-Google-Attributes: gidf71eb,public
From: anderson@cnw.com (Anderson)
Subject: Re: In batch files, how to eval a variable?
Date: 1995/10/03
Message-ID: <44s38r$7nf@lassen.cnw.com>
X-Deja-AN: 117018766
references: <44e13f$gka$1@sydney.DIALix.oz.au>
organization: Connect Northwest
newsgroups: comp.os.msdos.misc,comp.sys.ibm.pc.misc,aus.computers.ibm-pc