字串替換功能也可以用來從一個字串中刪除一個子字串。
範例
@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.