what does % mean in a batch file?

  • Thread starter Thread starter Don J
  • Start date Start date
D

Don J

What does "%" mean in a batch file?

Don J

-------------------------------------------
 
Using batch parameters.

Paste the following line into Start | Run and click OK...

hh ntcmds.chm::/percent.htm

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
Don said:
What does "%" mean in a batch file?

Don J

-------------------------------------------

refers to either an environment variable. like %path% (type set at
the command prompt for a full list). Or a parameter like %1 %2 %3

type - echo %path% or whatever variable to see the value of the
variable. and how
%path% or %blah% expands.

%1 %2 %3 are variables storing the parameters used when the batch
file was called. A batch file is a program and you can pass it
arguments. just like dir blah.txt is passing a parameter to dir.
If dir were a batch file, then the 'expression' %1 would expand to
blah.txt if %1 were written in the batch file.


Example-
C:\>a v b n m
---- a.bat -----
echo %path%
echo %2 %3 %4 %1
-----------------------

I learnt that back in the days of msdos 6.22 but how did I work it
out? im not sure. my main source was
http://www.vfrazee.com/ms-dos/6.22/help/ but I don't see much
reference to it. The closest I can find is in "Call"

I mustve seen examples too, there was the aweful magazine called PC
Format , which was mostly about games but they must've had the odd
batch file on the CD Or a brief mention on the letters page
 
I know what you mean.

Things we're curious about, but not enough to look anything up, and stumble
across something later. Happens to me all of the time.

Or you do look something up and stumble across additional info by accident.
;-)

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top