Thursday, January 13, 2011

Trim Quotes - Remove surrounding quotes via FOR command

Description:
The FOR command can be used to safely remove quotes surrounding a string. If the string does not have quotes then it will remain unchanged.

Script:

set str="cmd politic"
echo.%str%
for /f "useback tokens=*" %%a in ('%str%') do set str=%%~a
echo.%str%

http://www.dostips.com/DtTipsStringManipulation.php

No comments:

Post a Comment