delorie.com/archives/browse.cgi   search  
Mail Archives: opendos/2002/01/03/06:46:03

X-Authentication-Warning: delorie.com: mailnull set sender to opendos-bounces using -f
Message-Id: <200201031119.g03BJGE19964@if.pwr.wroc.pl>
From: "Michal H. Tyc" <mhtyc AT if DOT pwr DOT wroc DOT pl>
Organization: Institute of Physics, Wroclaw University of Technology
Date: Thu, 03 Jan 2002 12:44:55 +0100
X-Mailer: Arachne V1.70;rev.3
To: opendos AT delorie DOT com
Subject: Re: on a related note
MIME-Version: 1.0
Reply-To: opendos AT delorie DOT com

On Thu, 3 Jan 2002 21:07:54 +1100 (EST), DONALD PEDDER wrote:

> My next obstacle is passing more than 9 parameters to it - any ideas?

You can pass any number of parameters that fit on DOS command line,
but you can access only 10 of them at a time. Use SHIFT command,
which does the following:
* throws away %0 (which is the batch file name, as typed on command line)
* %0 := %1
* %1 := %2
...
* %8 := %9
* %9 := tenth parameter.
You may use SHIFT as many times as you wish.

If you need to access all parameters at a time, you have to remember some
in environment variables, e.g.,

SET PAR1=%1
SET PAR2=%2
SHIFT
SHIFT
SHIFT
REM Now PAR1=1st param, PAR2=2nd param, %0=3rd param, %1=4th param, 
REM and %9=12th param.
REM ... 
REM At the end, clean your environment:
SET PAR1=
SET PAR2=

Hope this helps,

Michal

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019