Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch    |    Fun with MS-DOS batch files    |    42,547 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 40,634 of 42,547    |
|    terrencelward@gmail.com to bke...@keadle.net    |
|    Re: Remove leading & trailing spaces fro    |
|    28 Apr 13 00:34:48    |
   
   d0c689fa   
   On Saturday, October 22, 2011 4:17:53 AM UTC-7, bke...@keadle.net wrote:   
   > This works for me:   
   >   
   >   
   >   
   > set MYVAR= Variable with spaces   
   >   
   > echo [%MYVAR%]   
   >   
   > echo.   
   >   
   > for /f "tokens=* delims= " %%A in ('echo %MYVAR% ') do set MYVAR=%%A   
   >   
   > set MYVAR=%MYVAR:~0,-1%   
   >   
   > echo [%MYVAR%]   
   >   
   >   
   >   
   > NOTE: you must "force" at least on trailing space in 'echo %MYVAR% '   
      
   Thanks! This worked perfectly for me as well.   
      
   --- 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