Character replacement

  • Thread starter Thread starter Jerold Schulman
  • Start date Start date
J

Jerold Schulman

If I want to remove the character X in a %string% variable, I would use
set string=%string:X=%

If I want to remove the character = in a %string% variable, what do I do, other
than looping through and testing?





Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Jerold said:
If I want to remove the character X in a %string% variable, I would use
set string=%string:X=%

If I want to remove the character = in a %string% variable, what do I do, other
than looping through and testing?





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

C:\cmd>demo\string
string=this is a string with an equals = sign in it.
string=this is a string with an equals sign in it.

C:\cmd>rlist demo\string.cmd
=====begin C:\cmd\demo\string.cmd ====================
1. @echo off
2. set string=this is a string with an equals = sign in it.
3. set string
4. for /f "tokens=1* delims==" %%a in (
5. 'echo %string%'
6. ) do set string=%%a%%b
7. set string
=====end C:\cmd\demo\string.cmd ====================
 
C:\cmd>demo\string
string=this is a string with an equals = sign in it.
string=this is a string with an equals sign in it.

C:\cmd>rlist demo\string.cmd
=====begin C:\cmd\demo\string.cmd ====================
1. @echo off
2. set string=this is a string with an equals = sign in it.
3. set string
4. for /f "tokens=1* delims==" %%a in (
5. 'echo %string%'
6. ) do set string=%%a%%b
7. set string
=====end C:\cmd\demo\string.cmd ====================

Thanks Phil.


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