howto strip special caracters from string

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

Henry

Good day.
I have to pass string to a script but need to remove
certain caracters before hand. Lets say I have the
following string:
My name is [John] and my surname (Doe)
I need to use this string as is without the [] or (). How
can I achive this?
 
Henry said:
Good day.
I have to pass string to a script but need to remove
certain caracters before hand. Lets say I have the
following string:
My name is [John] and my surname (Doe)
I need to use this string as is without the [] or (). How
can I achive this?

Hello Henry,

see set /?

@echo off
setlocal
set string=My name is [John] and my surname (Doe)
set "string=%string:[=%"
set "string=%string:]=%"
set "string=%string:(=%"
set "string=%string:)=%"
echo %string%
 
Back
Top