批处理脚本 - 删除两端



这用于删除字符串的首尾字符

示例

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