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,963 of 68,980   
   R.Wieser to All   
   echo a variable containing an & sometime   
   20 Nov 22 12:48:12   
   
   From: address@not.available   
      
   Hello all,   
      
   I've written a test batch showing a directory tree.  In it I noticed that   
   echo-ing an argument containing a pathname containing an "&" causes a   
   problem when done directly :   
      
   echo %~xn1   
      
   but doesn't when done indirectly :   
      
   for %%a in (%1) do echo %%~xna   
      
   Does anyone have an explanation for it ?   
      
      
   And a question : How do I tell the batchfile parser *not* to parse the %~xn1   
   results but instead just display it as-is ?   
      
   I know that I can wrap it in doublequotes :   
      
   echo "%~xn1"   
      
   but those doublequotes get displayed too. :-(   
      
   Regards,   
   Rudy Wieser   
      
   --- 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