🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

In batch files, how to eval a variable?

#3957
From: John Savage
Date: Thu, 28 Sep 1995 00:00
19 lines
1412 bytes
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
Technical Details
Message-ID: <44e13f$gka$1@sydney.DIALix.oz.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d683,6193436daef3f8c5,start
X-Google-Attributes: gid10d683,public
X-Google-Thread: f53ba,6193436daef3f8c5,start
X-Google-Attributes: gidf53ba,public
X-Google-Thread: f71eb,6193436daef3f8c5,start
X-Google-Attributes: gidf71eb,public
From: koala@sydney.DIALix.oz.au (John Savage)
Subject: In batch files, how to eval a variable?
Date: 1995/09/28
Message-ID: <44e13f$gka$1@sydney.DIALix.oz.au>
X-Deja-AN: 110918604
sender: koala@sydney.DIALix.oz.au
organization: Gumleaf Smoke Signals Telegraph Company
newsgroups: comp.os.msdos.misc,comp.sys.ibm.pc.misc,aus.computers.ibm-pc