| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | globally parse command line parameters |
Hi! Richard, 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? Mmm... maybe. I've never used it before, strangely; I've never had a need. What do you think of this (based on your suggestion)... -----88----- (main batch...) :: Needs to be executed with parameter list... :: :: [batch_filename] %1 %2 %3 %4 %5 %6 %7 %8 %9 :: [ ... ] set CALLSIGN=%1 set DONEYET=nope set REPORT=report.txt :BEGIN shift call CHEKPARM %1 if [%DONEYET%]==[nope] goto BEGIN [ ...] for %%v in (CALLSIGN DONEYET REPORT) do set %%v= :END (CHEKPARM batch...) [ ... ] if [%1]==[] goto FINISH :START [ ... ] if [%1]==[p] echo %CALLSIGN% papa >>%REPORT% if [%1]==[q] echo %CALLSIGN% quebec >>%REPORT% [ ... ] :FINISH set DONEYET=youbet :STOP [ ...] -----88----- If each of the paragraphs (like 'papa') were doing more than I've imagined, then each of the "if [%1]==[?]" tests could do a -call- to a third batch file instead. RW> I still want to make use of the parameter entered as %1 RW> though. Of course. :) Is the above close to what you're looking for? Cheers, Paul. ... On this BBS, we recycle all of our bytes, bit by bit. --- GoldED+/LNX 1.1.4.7* Origin: Quinn's Post - Maryborough, Queensland, OZ (3:640/384) SEEN-BY: 633/260 267 640/384 954 1674 712/0 313 848 800/445 @PATH: 640/384 954 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™.