It says
The FOR command can be used to safely remove quotes surrounding a string
The demonstration is supposed to remove double quotes surrounding a string. If that's the case, a simple remove might do, such as the method demonstrated here.
What if I feel that things are not so simple? For example, the batch code fails when there are strings such as
Code: Select all
@echo off
set str=test "cmd politic" test2
echo.%str%
for /f "useback tokens=*" %%a in ('%str%') do set str=%%~a
echo.%str%
So its supposed to remove the double quotes surrounding "cmd politic", but what i see is this
Code: Select all
C:\work>test.bat
test "cmd politic" test2
test "cmd politic" test2
when i should be getting
Code: Select all
test cmd politic test2
Again , a simple remove might be used for this case. Why a for loop? What does it mean by "safely remove double quotes surrounding a string"
DosItNotHelp