Batch Script - Remove


Advertisements

The string substitution feature can also be used to remove a substring from another string.

Example

@echo off 
set str = Batch scripts is easy. It is really easy. 
echo %str% 

set str = %str:is = % 
echo %str%

The key thing to note about the above program is, the ‘is’ word is being removed from the string using the :’stringtoberemoved’ = command.

Output

The above command produces the following output.

Batch scripts is easy. It is really easy. 
Batch scripts easy. It really easy.
batch_script_strings.htm
Advertisements