home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 67,630 of 68,980   
   Zaidy036 to Kenny McCormack   
   Re: Two simple, but related questions ab   
   30 Sep 20 17:04:02   
   
   From: Zaidy036@air.isp.spam   
      
   On 9/29/2020 12:16 PM, Kenny McCormack wrote:   
   > 1) Is there a simple way to get the number of args passed to a batch (.BAT   
   >      or .CMD) file?  Like $# in Unix.   
   >   
   > 2) Just out of curiosity, where are the command line args documented in the   
   >      DOS/Windows command prompt help system?  I know that things like %~xX   
   >      are documented in "help for", but what about the really basic stuff,   
   >      like %1, %2, %*?   
   >   
   I do not know Unix but something like the following will let you, by   
   changing the cmds in FINDSTR, set a variable name which could be a   
   counter. %%~AI may also need to be changed depending on type of variable:   
      
   FOR %%F IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO (   
   FOR %%I IN (%%F) DO ECHO %%~AI > F:\_ATTRIB.TXT   
   FINDSTR r F:\_ATTRIB.TXT && ATTRIB -R %%F || ATTRIB +R %%F   
   )   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca