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,971 of 68,980   
   R.Wieser to All   
   Re: echo a variable containing an & some   
   20 Nov 22 21:04:33   
   
   From: address@not.available   
      
   Herbert,   
      
   > set /p a="%~xn1" I don't know how to get a & in %1 without surrounding it   
   > in "" so I can't test it.   
      
   Ive put a few lines of text ("hello&world", "&foo", "bar&") in a file,   
   retrieved those lines and than called your ":sub" with it like this :   
      
   for /f %%i in (words.txt) do call :sub %%i   
      
   , but for some reason your ":sub" was not called for the first two (though   
   no error or other output), but it was for the third/last line.  IOW, I could   
   not test it either ...   
      
   It "ofcourse" worked fine when I enclosed the %%i argument in double-quotes,   
   but that also negated the test itself. :-|   
      
   > But set/p seems to remove the "":   
      
   It does seem to do that, yes.   Though I think I like the   
      
   for %%a in (%1) do echo %%~nxa   
      
   trick better.  :-)   
      
   I also tried a line (in the textfile) with an embedded doublequote.  The it   
   caused the "set /p" to wait for input again.  And ofcourse the simple "echo   
   %1" had no problems with it.   
      
   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