字符串替换功能还可用于从另一个字符串中删除子字符串。

Remove - 示例

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

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

关于上述程序,需要注意的关键是,使用:'stringtoberemoved'=command 从字符串中删除了" is"一词。

上面的命令产生以下输出。

Batch scripts is easy. It is really easy. 
Batch scripts easy. It really easy.

参考链接

https://www.learnfk.com/batch-script/batch-script-remove.html