批處理刪除字串

字串替換功能也可以用來從一個字串中刪除一個子字串。

示例

@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.

上一篇: 批處理字串 下一篇: 批處理數組