| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | globally parse command line parameters |
Hi Paul,
On Wed 2037-Apr-08 16:04, Paul Quinn (3:640/384) wrote to Richard Webb:
PQ> On 05 Apr 09 19:19, you wrote to all:
RW> I just don't want to have to repeat those if %1== statements for %2
RW> for the same values basically.
RW> Any quick and dirty way to get around it?
RW> maybe shift?
PQ> Mmm... maybe. I've never used it before, strangely; I've never had
PQ> a need. What do you think of this (based on your suggestion)...
PQ> -----88-----
PQ> (main batch...)
PQ> :: Needs to be executed with parameter list...
PQ> ::
PQ> :: [batch_filename] %1 %2 %3 %4 %5 %6 %7 %8 %9
PQ> ::
PQ> [ ... ]
PQ> set CALLSIGN=%1
PQ> set DONEYET=nope
PQ> set REPORT=report.txt
PQ> :BEGIN
PQ> shift
PQ> call CHEKPARM %1
PQ> if [%DONEYET%]==[nope] goto BEGIN
PQ> [ ...]
PQ> for %%v in (CALLSIGN DONEYET REPORT) do set %%v=
PQ> :END
PQ> (CHEKPARM batch...)
PQ> [ ... ]
PQ> if [%1]==[] goto FINISH
PQ> :START
PQ> [ ... ]
PQ> if [%1]==[p] echo %CALLSIGN% papa >>%REPORT%
PQ> if [%1]==[q] echo %CALLSIGN% quebec >>%REPORT%
PQ> [ ... ]
PQ> :FINISH
PQ> set DONEYET=youbet
PQ> :STOP
PQ> [ ...]
PQ> -----88-----
Ya know, I think you've hit it. sTore %1 as environment
variable and off to the races.
PQ> If each of the paragraphs (like 'papa') were doing more than I've
PQ> imagined, then each of the "if [%1]==[?]" tests could do a -call- to
PQ> a third batch file instead.
Each of those, such as papa, is what we call a
transcontinental corps schedule. But it opens up some
possibilities.
sOmething to chew on and play with once IO've gotten the
requisite intake of morning caffeine.
Regards,
Richard
--- timEd 1.10.y2k+
* Origin: Radio REscue net operations BBS (1:116/901)SEEN-BY: 10/1 3 34/999 120/228 123/500 128/2 140/1 222/2 226/0 249/303 250/306 SEEN-BY: 261/20 38 100 1381 1404 1406 1410 1418 266/1413 280/1027 320/119 SEEN-BY: 393/68 396/45 633/104 260 267 285 640/954 690/682 734 712/0 313 848 SEEN-BY: 800/432 801/161 189 2222/700 2320/100 105 200 2905/0 @PATH: 116/901 3634/12 123/500 261/38 633/260 712/848 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.