批處理指令碼 - 刪除兩端



這用於刪除字串的首尾字元

示例

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

set str = %str:~1,-1% 
echo %str%

對於上面的程式,需要注意的是,~1,-1 用於刪除字串的首尾字元。

輸出

上述命令產生以下輸出。

Batch scripts is easy. It is really easy 
atch scripts is easy. It is really eas
batch_script_strings.htm
廣告
© . All rights reserved.