bat – 批量替换文件名字符

bat – 批量替换文件名字符批量替换文件名字符 echooff amp setlocalenab 这是提示输入文件位置 直接打开文件夹复制路径 黏贴就行 set ppath pleasepaste inputyourExc set pstr Pleaseentert set

批量替换文件名字符

@echo off & setlocal enableDelayedExpansion rem 1 这是提示输入文件位置,直接打开文件夹复制路径、黏贴就行 set /p path=please paste/input your Excel Path : set /p str=Please enter the character to be replaced: set /p ChangeStr=Please enter the target character: REM 当前路径,如果在当前文件解开下面注释即可, REM set path=%~dp0 cd /d %path% rem 2 这是通过循环去修改文件夹里面的文件名字 for /f "delims=!" %%i in ('dir /aa /b %path%') do ( ::echo in progressing %%i_%%j_%%k set str1=%%i set str2=!str1:%str%=%ChangeStr%! echo str1 is !str1! str2 is !str2! ren "!str1!" "!str2!" ) rem 3 结束,并打开文件位置 echo. echo. echo its ok now,the file locate at %path% rem 打开文件位置 REM C:\Windows\explorer.exe %path% 

使用教程:

新建 .bat 文件,复制上面代码,保存,点击运行,

  1. 输入需要 替换的路径,
  2. 输入需要替换的字符
  3. 输入替换后的字符
    回车键,修改完成

如图:

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/222148.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月17日 下午4:28
下一篇 2026年3月17日 下午4:28


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号