本帖最后由 wocool 于 2021-9-18 23:45 编辑
回复 7# Fit
大佬您好,按照查错方法我也把您这运行回显报给您,帮忙看看!问题就是并没用重命名发生。
执行后如下:- Z:\111>test.bat
-
- Z:\111>setlocal enabledelayedexpansion
-
- Z:\111>set my=test.bat
-
- Z:\111>for /F %i in ('dir /b /a-d') do (if not "%i" == "test.bat" (
- call:StrLen %~ni
- echo ren %i !name!%~xi
- ) )
-
- Z:\111>(if not "123.123" == "test.bat" (
- call:StrLen 123
- echo ren 123.123 !name!.123
- ) )
-
- Z:\111>set /a len=0
-
- Z:\111>set str=123
-
- Z:\111>set name=
-
- Z:\111>for /L %i in (0 1 50) do (if not "!str:~%i,1!" == "" (
- set name=!name!!str:~%i,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~0,1!" == "" (
- set name=!name!!str:~0,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~1,1!" == "" (
- set name=!name!!str:~1,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~2,1!" == "" (
- set name=!name!!str:~2,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~3,1!" == "" (
- set name=!name!!str:~3,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~4,1!" == "" (
- set name=!name!!str:~4,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~5,1!" == "" (
- set name=!name!!str:~5,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~6,1!" == "" (
- set name=!name!!str:~6,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~7,1!" == "" (
- set name=!name!!str:~7,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~8,1!" == "" (
- set name=!name!!str:~8,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~9,1!" == "" (
- set name=!name!!str:~9,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~10,1!" == "" (
- set name=!name!!str:~10,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~11,1!" == "" (
- set name=!name!!str:~11,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~12,1!" == "" (
- set name=!name!!str:~12,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~13,1!" == "" (
- set name=!name!!str:~13,1!飞
- set /a len+=1
- ) else (goto:eof) )
-
- Z:\111>(if not "!str:~14,
复制代码 回显过长无法完全显示实在抱歉!!
|