Removing & from string
Posted: 16 Oct 2008 14:56
I used FINDSTR in a FOR loop to pull out a specific string. The string contains an & in it. I am trying to remove it. I tried set q=%q:^&=% and it did not work. Any ideas?
Code: Select all
set "q=%q:&=%"
Code: Select all
setlocal enabledelayedexpansion
set q=this^&that
echo %q%
set q=!q:^&=or!
echo %q%
Code: Select all
@echo off
set "q=this&that"
echo."%q%"
set "q=%q:&=%"
echo. %q%
@echo off
set "q=(doc NAME\ &\ NAME2\ NAME3)"
echo."%q%"
set "q=%q:&=%"
set "q=%q:(=%"
set "q=%q:)=%"
set "q=%q:\=%"
echo. %q%
Code: Select all
"this&that"
thisthat
"(doc NAME\ &\ NAME2\ NAME3)"
doc NAME NAME2 NAME3