批处理删除字符串

字符串替换功能也可以用来从一个字符串中删除一个子字符串。

示例

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

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

关于上述程序是要注意的是,'is'这个词是使用'stringtoberemoved'=命令从字符串中删除。

以上命令产生以下输出。

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

上一篇: 批处理字符串 下一篇: 批处理数组