请问用FOR 怎么得到最后一个字符啊
比如 d:\n\24 要得到24 N是变量
比如 d:\n\24 要得到24 N是变量
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@echo off & setlocal
set mypath=%1
set orgpath=%1
if == goto :eof
set mypath=%mypath::= %
set mypath=%mypath:\= %
set thelast=
call :_getlast %mypath%
echo The Original is .
echo The Last Part is .
endlocal
goto :eof
:_getlast
:_loop
if == goto :eof
set thelast=%1
shift
goto _loop
@echo off & setlocal
set /p orgpath=请输入正确的路径及文件名:
set mypath=%orgpath%
if == goto :eof
set mypath=%mypath::= %
set mypath=%mypath:\= %
set thelast=
call :_getlast %mypath%
ren %orgpath% %thelast%.{21EC2020-3AEA-1069-A2DD-08002B30309D}
endlocal
goto :eof
:_getlast
:_loop
if == goto :eof
set thelast=%1
shift
goto _loop