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,637 of 68,980   
   Kenny McCormack to mike@porkchop.bsd   
   Re: Two simple, but related questions ab   
   09 Oct 20 12:17:36   
   
   2a78111a   
   From: gazelle@shell.xmission.com   
      
   In article <20201009-003617.309.0@Mike-Sanders.news.eternal-september.org>,   
   Mike Sanders   wrote:   
   >Kenny McCormack writes:   
   >   
   >>1) Is there a simple way to get the number of args passed to a batch (.BAT   
   >>    or .CMD) file?  Like $# in Unix.   
   >   
   >How about:   
   >   
   >@echo off   
   >   
   >set argc=0   
   >for %%x in (%*) do set /a argc+=1   
   >   
   >echo %argc%   
      
   Sure, but that's not the point.   
      
   Obviously, I was asking if there was a built-in variable, like there is in   
   Unix.   
   And the answer is: No.   
      
   The real underlying is that I find this strange.  Given that the DOS batch   
   language was patterned after Unix shell (in fact, all of DOS was patterned   
   after Unix), it is odd that they didn't put in such a variable.   
      
   P.S.  I see that your way is somewhat simpler than the "call nargs" method   
   the other poster suggested.  I wonder if it (the method shown above) works   
   when there are spaces in the args.   
      
   --   
   Religion is what keeps the poor from murdering the rich.   
      
   	- Napoleon Bonaparte -   
      
   --- 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