批处理处理字符串

@echo off

rem 替换字符串
set a=www.baidu.com
set a=%a:.=-%
echo %a%

rem 截取字符串
set a=www.baidu.com
set a=%a:~4,4%

set a=www.baidu.com
set a=%a:~-5%
echo %a%

set a=www.baidu.com
set a=%a:~0,-5%
echo %a%
pause
exit

posted @ 2016-01-24 11:10  绿尘枫  阅读(165)  评论(0编辑  收藏  举报