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 68,876 of 68,980   
   Anton Shepelev to All   
   Comma in an argument value   
   27 Nov 24 19:21:24   
   
   From: anton.txt@g{oogle}mail.com   
      
   Hello, all.   
      
   What does the following script:   
      
   @ECHO OFF   
   FOR /F "tokens=2,* delims= " %%A in ("%*") DO SET ARGS=%%B   
   ECHO M:1:%1   
   ECHO M:2:%2   
   ECHO M:*:%ARGS%   
      
   stored as test.bat invoked as   
      
   > test.bat a "b,c" d e   
      
   print:   
      
   1:a   
   2:"b,c"   
   *:c" d e   
      
   ?   
      
   I expected it to print:   
      
   1:a   
   2:"b,c"   
   *:d e   
      
   because the FOR /F loop should split the parameter by the   
   space characer, and end up with all the token after the second   
   one in the ARGS variable. Why is the comma treated as a command   
   separator at some point?   
      
   --   
   ()  ascii ribbon campaign -- against html e-mail   
   /\  www.asciiribbon.org   -- against proprietary attachments   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

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


(c) 1994,  bbs@darkrealms.ca