Character replacement

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
 
P

Phil Robyn

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 ====================
 
J

Jerold Schulman

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top