Removing "=" from a string

  • Thread starter Thread starter Henry
  • Start date Start date
H

Henry

Hi

In bathc, I make use of the following cmd to remove
certain caracters from strings:
set "string=%string:$%" this will for example remove the $
from the string.

This however doesn't work when I try to remove the equal
sign =.

Any idea how I can remove the = from a string?
Thanks
 
Hi

In bathc, I make use of the following cmd to remove
certain caracters from strings:
set "string=%string:$%" this will for example remove the $
from the string.

This however doesn't work when I try to remove the equal
sign =.

Any idea how I can remove the = from a string?
Thanks


See tip 7402 in the 'Tips & Tricks' at http://www.jsiinc.com

call rewb string newstring

where string is a constant or variable that contains one or more equal signs, and newstring is a call directed environment variable that will contain string with spaces instead of equal signs.

REWB.bat contains:

@echo off
if {%2}=={} @echo Syntax REWB String Newstring&goto :EOF
setlocal
set string=%1
:again
set work=%string%
for /f "Tokens=1* Delims==" %%a in ('@echo %string%') do if {%%b} NEQ {} set string=%%a %%b
if {%string%} NEQ {%work%} goto again
endlocal&set %2=%string%




Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Back
Top