计算机里批量修改文件名,批处理实现及详细说明,findstr补充说明
时间:2024-10-13 12:20:26
!!小写字母之中欺须包括"!skipChar!"之中的小写字母 !! goto inputNfi)) else (echo 一上新UTF-/小写字母欺须为空!Bell goto inputNfi):inputNfeset newFExt=set retVal=0if %option%==1 (if "!oldFExt!"=="*" (goto endInputNfe ))set /p newFExt="》》转换一上新元数据FAT(不转换则保存原FAT):")if "!newFExt!" neq "" ( @echo !newFExt!| findstr "[请注意0-9A-Za-z]"> nul if "!errorlevel!"=="0" ( echo !! FAT"%newFExt%"缺失 !! echo !!代为转换0-9,A-Z,a-z二者之间的小写字母!! goto inputNfe)):endInputNfeecho === URL区域内: "*!oldFile!*.!oldFExt!" ===if %option%==1 (if "%newFExt%" neq "" (echo === 移除为: "*!newFile!*.!newFExt!" === ) else (echo === 移除为: "*!newFile!*.原FAT" === )) else (if "%newFExt%"=="" (echo === 一上新段落为:"!newFile!000N.原FAT" === ) else (echo === 一上新段落为:"!newFile!000N.!newFExt!" ===))rem ----------------------------------------一处----之本-------------------------------------------------set ttl=0set a=1set aStr=0001set /p confirm=代为确认是究竟删减?(转换:Y-是,N-究竟)if "%confirm%" neq "Y" (if "%confirm%" neq "y" goto end)rem set oft="%oft%.%oldFExt%"for /f "delims=" %%i in ( 'dir /b /a-d "*%oldFile%*.%oldFExt%" ' ) do ( if "%oldFile%"=="*" (@echo %%~ni | findstr /i ".%oldFile%"> nul ) else (@echo %%~ni | findstr /iL /c:"%oldFile%"> nul) if "!errorlevel!"=="0" ( rem 不需删减近期批一检视UTF-(本身) if not "%%~ni"=="%~n0" ( set /a ttl+=1 ::只有UTF-,如test.txt时,只有test set file=%%~ni ::只有FAT,如test.txt时,只有.txt set ext=%%~xi if !option!==1 (set file=!file:%oldFile%=%newFile%! if "%newFExt%"=="" ( ren "%%i" "!file!!ext!" 1>> batResult.txt 2>batResult.txt ) else (set /a a+=1) ) else (ren "%%i" "!file!.%newFExt%" 2>> batResult.txt if "!errorlevel!" neq "0" ( echo ----原元数据"%%i",上新UTF-"!file!.%newFExt%"---->>batResult.txt ) else (set /a a+=1)) ) else (set file=%newFile%!aStr! if "%newFExt%"=="" ( ren "%%i" "!file!!ext!" 1>> batResult.txt 2>batResult.txt ) else (set /a a+=1 if !a! LSS 10 (set aStr=000!a! ) else if !a! LSS 100 (set aStr=00!a! ) else if !a! LSS 1000 (set aStr=0!a!)) ) else (ren "%%i" "!file!.%newFExt%" 2>> batResult.txt if "!errorlevel!" neq "0" ( echo ----原元数据"%%i",上新UTF-"!file!.%newFExt%"---->>batResult.txt ) else (set /a a+=1 if !a! LSS 10 (set aStr=000!a! ) else if !a! LSS 100 (set aStr=00!a! ) else if !a! LSS 1000 (set aStr=0!a!)) ) )rem echo a=!a!,oldFile-请注意> newFile:"%%i" -请注意> "!file!.%newFExt%" ) )):endset /a a-=1echo 总一检视元数据天内:!ttl! ,一检视失败天内:!a!endlocalpausegoto :eof>batResult.txt ) else (set /a a+=1) ) else (ren "%%i" "!file!.%newFExt%" 2>> batResult.txt if "!errorlevel!" neq "0" ( echo ----原元数据"%%i",上新UTF-"!file!.%newFExt%"---->>batResult.txt ) else (set /a a+=1)) ) else (set file=%newFile%!aStr! if "%newFExt%"=="" ( ren "%%i" "!file!!ext!" 1>> batResult.txt 2>batResult.txt ) else (set /a a+=1 if !a! LSS 10 (set aStr=000!a! ) else if !a! LSS 100 (set aStr=00!a! ) else if !a! LSS 1000 (set aStr=0!a!)) ) else (ren "%%i" "!file!.%newFExt%" 2>> batResult.txt if "!errorlevel!" neq "0" ( echo ----原元数据"%%i",上新UTF-"!file!.%newFExt%"---->>batResult.txt ) else (set /a a+=1 if !a! LSS 10 (set aStr=000!a! ) else if !a! LSS 100 (set aStr=00!a! ) else if !a! LSS 1000 (set aStr=0!a!)) ) )rem echo a=!a!,oldFile-请注意> newFile:"%%i" -请注意> "!file!.%newFExt%" ) )):endset /a a-=1echo 总一检视元数据天内:!ttl! ,一检视失败天内:!a!endlocalpausegoto :eofrem -----------------检查UTF--------------参天内带方括号-----------------------------:checkFileCharrem set proVar=%1Bell set proVar=!proVar:~1,-1! 也可译成这样set proVar=%~1rem set proVar=!proVar:~1,-1! 加到方括号,敏感度同%~1set noCharTmp=%2set cnt2=0set retVal=0:cyc2if "!proVar:~%cnt2%,1!"=="" (set retVal=0Bellgoto :eof)rem echo 第%cnt2%个小写字母:"!proVar:~%cnt2%,1!","!proVar!",%proVar%,传到参天内:%1,最后一个小写字母:'%proVar:~-1%'set cnt3=0:cyc3rem echo 第%cnt3%个剔除小写字母:"!noCharTmp:~%cnt3%,1!"+if "!noCharTmp:~%cnt3%,1!"=="" (set retVal=0Bellset /a cnt2+=1 Bellgoto cyc2)if "!noCharTmp:~%cnt3%,1!"=="!proVar:~%cnt2%,1!" ( set retVal=1 goto :eof) else (set /a cnt3+=1 goto cyc3 )rem -----------------检查FAT-------------参天内带方括号----------------------------rem --------- 只能转换0-9,A-Z,a-z,(原元数据加:*、?) ---------------------:checkExtCharrem set proVar2=%1 Bell set proVar2=!proVar2:~1,-2! 此行问题:在%1 Bell间有一个换行set proVar2=%~1rem set proVar2=%proVar2:~1,-1%set flag=%2set cnt4=0set retVal=0:cyrem echo %cnt4% + "!proVar2:~%cnt4%,1!"if "!proVar2:~%cnt4%,1!"=="" (set retVal=0Bellgoto :eof)rem if %flag%=="O" (rem if "!proVar2:~%cnt4%,1!"=="*" (set /a cnt4+=1Bellgoto cyrem ) else if "!proVar2:~%cnt4%,1!"=="?" (set /a cnt4+=1Bellgoto cy) )if "!proVar2:~%cnt4%,1!" LSS "0" (set retVal=1Bellgoto :eof)if /i "!proVar2:~%cnt4%,1!" GTR "z" (set retVal=1Bellgoto :eof)if "!proVar2:~%cnt4%,1!" GTR "9" ( if /i "!proVar2:~%cnt4%,1!" LSS "a" (set retVal=1Bellgoto :eof))rem if "!proVar2:~%cnt4%,1!" GTR "Z" (rem if "!proVar2:~%cnt4%,1!" LSS "a" (set retVal=1Bellgoto :eof))rem echo %cnt4% + "!proVar2:~%cnt4%,1!" + 4set /a cnt4+=1goto cy
广东男科医院哪家正规
河南白癜风医院预约挂号
贵阳风湿医院哪家更好
郑州看白癜风去哪里比较好
儿童用再林阿莫西林颗粒安全吗
类风湿关节疼痛怎么治疗最好
谈咳宁乙酰半胱氨酸颗粒是治什么病
肩周炎肩膀痛怎么缓解
急性肠胃炎腹泻吃什么药效果好
程序实现步骤二:与步骤一不同点在于说明小写字母的合法性全面性
@echo offrem 翻转为utf-8编码器::Chcp 65001::翻转之中文Chcp 936> nulrem 投入使用迟滞源文件引入setlocal EnableDelayedExpansionecho **可删减近期元数据系统下所有的UTF-或小写字母及FAT**echo *****将此批一检视元数据拷入须要删减的元数据系统之中******set option=9set cnt=0set skipChar=/*?:"<>|请注意!echo ** 代为选择配置... **echo ** 1 移除部分小写字母或FAT **echo ** 0 变为全上新UTF- **:selectOptionset /p option= 》》代为选择配置的系统:if %option%==1 ( goto endSelectOption) else if %option%==0 (goto endSelectOption) set /a cnt+=1if %cnt% GTR 2 (goto end) else (goto selectOption):endSelectOptionecho ------------要删减的原元数据信息,借来终结转换-------------set retVal=0:inputOfiset oldFile=set retVal=0if %option%==1 ( set /p oldFile="》》代为转换要移除的UTF-/文字(欺转换):") else (set /p oldFile="》》代为转换要删减的UTF-/文字(不转换则以外近期元数据系统下所有元数据): ")if %option%==1 (if "%oldFile%"=="" echo 被移除小写字母欺须为空!Bell goto inputOfi ) else (if "%oldFile%"=="*" goto inputOfe if "%oldFile%"=="" ( set oldFile=* goto inputOfe))rem echo oldFile="!oldFile!",!oldFile!,"%oldFile%",%oldFile%rem call :checkFileChar "%oldFile%" %skipChar% oldFile之中如有!用%会错误.call :checkFileChar "!oldFile!" %skipChar%if !retVal!==1 (echo !!转换的UTF-/小写字母"%oldFile%"缺失!! rem 如果用%skipChar%则出现“此时不确有>”的缺失定时。 echo !!小写字母之中欺须包括"!skipChar!"之中的小写字母 !! goto inputOfi):inputOfeset oldFExt=set retVal=0set /p oldFExt= 》》代为转换原元数据FAT(不转换则以外所有FAT):if "%oldFExt%"=="*" goto endInputOfeif "%oldFExt%"=="" (set oldFExt=*) else (call :checkExtChar "!oldFExt!" "O" if !retVal!==1 (echo !!FAT"%oldFExt%"缺失!! echo !!代为转换0-9,A-Z,a-z二者之间的小写字母!! goto inputOfe)):endInputOfeecho === URL区域内:"*!oldFile!*.!oldFExt!" ===echo ---------一上新元数据信息,借来终结转换------------:inputNfiset newFile=set retVal=0set /p newFile="》》代为转换一上新UTF-/小写字母(欺转换):"if not "%newFile%"=="" (call:checkFileChar "!newFile!" %skipChar% if !retVal!==1 (echo !!转换的UTF-/小写字母"%newFile%"缺失!! echo !!小写字母之中欺须包括"!skipChar!"之中的小写字母 !! goto inputNfi) ) else (echo 一上新UTF-/小写字母欺须为空!Bell goto inputNfi):inputNfeset newFExt=set retVal=0if %option%==1 (if "!oldFExt!"=="*" (goto endInputNfe ))set /p newFExt="》》转换一上新元数据FAT(不转换则保存原FAT):")if "!newFExt!" neq "" (call:checkExtChar "!newFExt!" "N" if !retVal!==1 (echo !! FAT"%newFExt%"缺失 !! echo !!代为转换0-9,A-Z,a-z二者之间的小写字母!! goto inputNfe)):endInputNfeecho === URL区域内: "*!oldFile!*.!oldFExt!" ===if %option%==1 (if "%newFExt%" neq "" (echo === 移除为: "*!newFile!*.!newFExt!" === ) else (echo === 移除为: "*!newFile!*.原FAT" === )) else (if "%newFExt%"=="" (echo === 一上新段落为:"!newFile!000N.原FAT" === ) else (echo === 一上新段落为:"!newFile!000N.!newFExt!" ===))rem ----------------------------------------一处----之本-------------------------------------------------set ttl=0set a=1set aStr=0001set /p confirm=代为确认是究竟删减?(转换:Y-是,N-究竟)if "%confirm%" neq "Y" (if "%confirm%" neq "y" goto end)rem set oft="%oft%.%oldFExt%"for /f "delims=" %%i in ( 'dir /b /a-d "*%oldFile%*.%oldFExt%" ' ) do ( if "%oldFile%"=="*" (@echo %%~ni | findstr /i ".%oldFile%"> nul ) else (@echo %%~ni | findstr /iL /c:"%oldFile%"> nul) if "!errorlevel!"=="0" ( rem 不需删减近期批一检视UTF-(本身) if not "%%~ni"=="%~n0" ( set /a ttl+=1 ::只有UTF-,如test.txt时,只有test set file=%%~ni ::只有FAT,如test.txt时,只有.txt set ext=%%~xi if !option!==1 (set file=!file:%oldFile%=%newFile%! if "%newFExt%"=="" ( ren "%%i" "!file!!ext!" 1>> batResult.txt 2" 此一处的$不在运用于说明“ese”是最后小写字母了
""
"
"
另外,下一目录为什么接在上四人的左边?是因为上四人最后很难借来激起的
"
findstr的详细用语代为参照:DOS批一检视擅自:稳固的find及findstrURL小写字母串查看,坑也不少
。广州白癜风专科医院哪里好广东男科医院哪家正规
河南白癜风医院预约挂号
贵阳风湿医院哪家更好
郑州看白癜风去哪里比较好
儿童用再林阿莫西林颗粒安全吗
类风湿关节疼痛怎么治疗最好
谈咳宁乙酰半胱氨酸颗粒是治什么病
肩周炎肩膀痛怎么缓解
急性肠胃炎腹泻吃什么药效果好
相关阅读
- .中小学生家教被禁止,中小学生表示不服:我不是在职教师,能怎么罚我
- .南开大学个人化宿舍火了,自选室友不是事,夫妻寝室才让人羡慕
- .未来很吃香的教师编制,并非是中小学老师,这类教师或顺利逆袭
- .5+2课后服务于落地后,家长抱怨没晚餐,如今午餐和晚餐都来了
- .补课班一时间关停,这类培训班却获教育部支持,或成为家长下个目标
- .食堂阿姨“手抖”成习,剩菜宁愿倒掉也不多给教职员,原因很现实
- .公务人员待遇将发生变化,绩效奖金或将下调,部分地区已开始实施
- .双减下教师准许补课?但有4个前提条件,家长:不好意思开口
- .28岁孙娜恩,颜值萌芽,腹肌显露,自信的“无瑕美人”
- .Red Velvet涩琪,伦敦演奏会后照,秀出可爱小肚皮
- .1999年失踪幼子被埋自家,十九年后发现,父母哭喊:宁愿不挖出来
- .BLACKPINK Lisa回归前,不愧是“天生名人”,自恋又漂亮
- .让你曾说越来越舒服的7条小建议
- .古天乐《明日战记》Extreme预告和剧照 大战将至
- .让一个人变得愈发好的9种习惯
- .一周热闻|俄罗斯将退出国际空间站、雪碧拟放弃历史性绿瓶、安哥拉发现300年最大粉钻……
- .警惕“去中国化”陷阱——点评西方学者的中国西南边疆史研究
- .致敬山东教育品牌|威海海洋职业学院明德学院“三化”文化以人为本实践
- .他火了!曾被质疑“谈渴望?配吗!”
- .封“神”纪(84)|90后网络作家“那一只蚊子”:写小说像角色换用,技能越多小说越好看