无涯教程-批处理 - Remove Both Ends函数

62 阅读1分钟

这用于删除字符串的第一个和最后一个字符

Remove Both Ends - 示例

@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

参考链接

www.learnfk.com/batch-scrip…