|
|
发表于 2024-2-5 22:10:50
|
显示全部楼层
根据要求,
1、汉字三字符,符号(包含中英)三字符,字母和数字一字符。
2、不含完整路径,只统计文件名(含后缀名)
3、字符长度可自由设置。- @echo off
- set /p n=请输入字符长度,回车默认140:
- if not defined n set n=140
- for /f "delims=" %%F in ('dir/b/s/a-d') do (
- if not exist "temp.vbs" call :vbs
- for /f %%a in ('cscript //nologo temp.vbs "%%~nxF"') do if %%a gtr %n% echo,%%F------字符长度:%%a >>超长名单.txt
- )
- del temp.vbs & exit
- :vbs
- (echo Dim regex, str, result
- echo Set regex = New RegExp
- echo regex.Pattern = "[A-Za-z0-9]"
- echo regex.Global = True
- echo str = WScript.Arguments.Item(0^)
- echo OGC=Len(str^)
- echo result = regex.Replace(str, ""^)
- echo NAC=Len(result^)
- echo wscript.echo OGC+NAC*2
- )> temp.vbs
- goto:eof
复制代码 |
|