批处理修改替换文件名

    批处理

1
2
3
4
5
6
7
8
@echo off
set strtemp3=文件扩展名
set strtemp1=被替换字符
set strtemp2=替换字符
setlocal enabledelayedexpansion
for /f "delims=" %%a in ('dir /a /b *.%strtemp3%') do (
set nobird=%%a
ren "%%~a" "!nobird:%strtemp1%=%strtemp2%!")

ps. 字符中包含汉字时,另存bat文件Encoding为ANSI即可。

10 Oct 2016

page PV:  ・  site PV:  ・  site UV: