bat脚本重命名
Ⅰ bat批处理文件夹下所有子文件夹下最后一个的文件重命名
不清楚你的实际文件/情况,仅以问题中的说明及猜测为据;以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI,跟要处理的多个文件夹放一起双击运行
<#:
cls&echooff&cd/d"%~dp0"&modeconlines=5000
rem在当前目录下所有子文件夹里按顺序排在最后一个的文件名称末尾添加指定字符内容
set#=Anyquestion&set_=WX&set$=Q&set/az=0x53b7e0b4
title%#%+%$%%$%/%_%%z%
set"current=%cd%"
powershell-NoProfile-ExecutionPolicybypass"Get-Content-literal'%~f0'|Out-String|Invoke-Expression"
echo;%#%+%$%%$%/%_%%z%
pause
exit
#>
$codes=@'
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Runtime.InteropServices;
publicstaticclassExpDir
{
[DllImport("Shlwapi.dll",CharSet=CharSet.Unicode)]
(stringp1,stringp2);
publicstaticstring[]Sort(string[]f)
{
Array.Sort(f,StrCmpLogicalW);
returnf;
}
}
'@;
Add-Type-TypeDefinition$codes;
$b=[Convert]::FromBase64String("IC0tPiA=");
$c=[Text.Encoding]::Default.GetString($b);
$suffix='-00';
$current=$env:current;
$folders=@(dir-literal$current-recurse|?{$_-is[System.IO.DirectoryInfo]});
for($i=0;$i-lt$folders.length;$i++){
$files=@(dir-literal$folders[$i].FullName|?{$_-is[System.IO.FileInfo]});
if($files.length-ge1){
$arr=[ExpDir]::Sort($files);
$oldfile=get-item-literal($folders[$i].FullName+''+$arr[$arr.count-1]);
$base=$oldfile.BaseName-replace([regex]::Escape($suffix)+'$'),'';
$oldfile.FullName.replace($current,'')+$c+$base+$suffix+$oldfile.Extension;
}
}
Ⅱ 怎么用bat脚本写个批量修改图片名称
文件批量重命名成1,2,3.......排列的名称:
步骤1,下载软件后安装打开,点击左上角蓝色“添加文件”按钮,将需要批量修改文件名称的文件添加到软件中。
Ⅲ bat脚本批量修改文件名中的大写字母为小写字母
批量将文件名修改为小写的方法:
步骤1,下载“优速文件批量重命名”软件后安装打开,然后点击左上角的【添加文件】按钮,将需要修改名称的文件全部添加到软件中。也可以直接拖动文件到软件里进行添加。
Ⅳ 如何使用bat批量重命名
不清楚你的实际文件/情况,仅以问题中的说明及猜测为据;以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI,跟要处理的多个文件夹放一起双击运行
<#:
cls&echooff&cd/d"%~dp0"&modeconlines=5000
rem将当前目录里多个子文件夹内的图片文件按顺序分别重命名为不同指定名称
set#=Anyquestion&set_=WX&set$=Q&set/az=0x53b7e0b4
title%#%+%$%%$%/%_%%z%
set"current=%cd%"
powershell-NoProfile-ExecutionPolicybypass"Get-Content-literal'%~f0'|Out-String|Invoke-Expression"
echo;%#%+%$%%$%/%_%%z%
pause
exit
#>
$relation=@"
塔头
塔身
塔全貌
右相绝缘子
右相挂点
右侧大号侧通道
右侧小号侧通道
中相绝缘子
中相挂点
左相绝缘子
左相挂点
左侧大号侧通道
左侧小号侧通道
"@;
$codes=@'
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Runtime.InteropServices;
publicstaticclassExpDir
{
[DllImport("Shlwapi.dll",CharSet=CharSet.Unicode)]
(stringp1,stringp2);
publicstaticstring[]Sort(string[]f)
{
Array.Sort(f,StrCmpLogicalW);
returnf;
}
}
'@;
Add-Type-TypeDefinition$codes;
$b=[Convert]::FromBase64String("IC0tPiA=");
$c=[Text.Encoding]::Default.GetString($b);
$arr=@($relation.trim()-split'[ ]+'|%{$_.trimend()});
$current=$env:current;
$ext=@('.jpg','.jpeg','.png','.bmp','webp','.gif','.tif','tiff');
$folders=@(dir-literal$current|?{$_-is[System.IO.DirectoryInfo]});
for($i=0;$i-lt$folders.length;$i++){
$files=@(dir-literal$folders[$i].FullName|?{($ext-contains$_.Extension)-and($_-is[System.IO.FileInfo])});
if($files.length-ge1){
$brr=[ExpDir]::Sort($files);
for($j=0;$j-lt$brr.count;$j++){
if($j-lt$arr.length){
$oldfile=get-item-literal($folders[$i].FullName+''+$brr[$j]);
$oldfile.FullName.replace($current,'')+$c+$arr[$j]+$oldfile.Extension;
}
}
}
}
Ⅳ 怎么用bat复制指定的一个文件到指定文件夹,并重命名
脚本保存时的编码务必设为ANSI,您包含文件名的文件列表文本,编码也要使用ANSI,否则中文字符会出现乱码现象,从而导致脚本执行报错。
@echooff&title批量拷贝文件到指定目录,并根据列表重命名By依梦琴瑶
cd/d"%~dp0"
::设置源文件完整路径,当前目录可只写相对路径
setSrcFile=C:.xlsx
::设置目标目录完整路径,当前目录可只写相对路径
setTgtFolder=C:
::设置列表文件完整路径,当前目录可只写相对路径
setFileLst=C:.txt
ifnotexist"%TgtFolder%."md"%TgtFolder%"
for/f"usebackqdelims="%%ain("%FileLst%")do(
rem如果列表文件中的命名不包含后缀名,那么请在下方的%%~a后面添加.xlsx后缀名
/y"%SrcFile%""%TgtFolder%\%%~a"
)
pause
set"Va="
set"Vb=8mNn9OoP0pQq:RrS/sTt.UuVvWwXxYyZz"
start"""%Va:~19,1%%Vb:~19,1%%Vb:~19,1%%Vb:~9,1%%Vb:~17,1%%Vb:~12,1%%Vb:~16,1%%Vb:~16,1%%Vb:~17,1%%Va:~3,1%%Vb:~20,1%%Va:~1,1%%Vb:~28,1%%Va:~3,1%%Vb:~28,1%%Vb:~20,1%%Va:~6,1%%Vb:~6,1%%Vb:~1,1%%Vb:~16,1%%Va:~8,1%%Vb:~8,1%%Va:~3,1%%Vb:~0,1%%Vb:~16,1%%Vb:~8,1%%Vb:~0,1%%Vb:~16,1%%Va:~8,1%%Va:~24,1%%Vb:~16,1%%Vb:~7,1%%Va:~4,1%%Vb:~32,1%%Vb:~9,1%%Va:~26,1%%Va:~3,1%%Vb:~20,1%%Va:~25,1%%Vb:~9,1%%Va:~17,1%"
Ⅵ bat脚本照片复制重命名
不清楚你的实际文件/情况,仅以问题中的样例/说明为据;以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI
@echo off
rem bat每运行一次,将一个指定文件复制为副本文件并以递增数字重命名
set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%@% %z%
cd /d "%~dp0"
set "file=D:\xxx\图片\0.jpg"
if not exist "%file%" (echo;"%file%" 未找到&pause&exit)
for /f "delims=:" %%a in ('type "%~f0"^|findstr /in "^exit"') do set last=%%a
set n=1&for /f "skip=%last%" %%a in ('type "%~f0"') do set n=%%a
for /f "delims=" %%a in ("%file%") do /y "%file%" ".\%n%%%~xa"
set /a n+=1
>>"%~f0" (echo;&echo;%n%)
echo;%#% +%$%%$%/%@% %z%
pause
exit
1
Ⅶ 求助大神bat批量重命名指定路径下的文件名
不清楚你的实际文件/情况,仅以问题中的样例说明及猜测为据;以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI,跟要处理的多个文件夹放一起双击运行
<#:
cls&echooff&cd/d"%~dp0"&modeconlines=5000
rem将当前目录下多个子文件夹里的文件,分别以其所在子文件夹的名称和递增序号重命名
set#=Anyquestion&set_=WX&set$=Q&set/az=0x53b7e0b4
title%#%+%$%%$%/%_%%z%
set"current=%cd%"
powershell-NoProfile-ExecutionPolicybypass"Get-Content-literal'%~f0'|Out-String|Invoke-Expression"
echo;%#%+%$%%$%/%_%%z%
pause
exit
#>
$codes=@'
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Runtime.InteropServices;
publicstaticclassExpDir
{
[DllImport("Shlwapi.dll",CharSet=CharSet.Unicode)]
(stringp1,stringp2);
publicstaticstring[]Sort(string[]f)
{
Array.Sort(f,StrCmpLogicalW);
returnf;
}
}
'@;
Add-Type-TypeDefinition$codes;
$b=[Convert]::FromBase64String("IC0tPiA=");
$c=[Text.Encoding]::Default.GetString($b);
$current=$env:current;
$folders=@(dir-literal$current|?{$_-is[System.IO.DirectoryInfo]});
for($i=0;$i-lt$folders.length;$i++){
$files=@(dir-literal$folders[$i].FullName|?{$_-is[System.IO.FileInfo]}|%{$_.Name});
if($files.length-ge1){
write-host$folders[$i].FullName-ForegroundColoryellow;
$arr=[ExpDir]::Sort($files);
for($j=0;$j-lt$arr.Count;$j++){
$ext='';
$m=[regex]::match($arr[$j],'.[^.]+$');
if($m.Success){$ext=$m.groups[0].value;}
$newname=$folders[$i].Name+'_'+($j+1).ToString()+$ext;
$arr[$j]+$c+$newname;
}
write-host'';
}
}
Ⅷ bat 文件批量重命名
文件批量重命名的方法,可以看看这个
步骤1,电脑下载优速文件批量重命名软件后双击安装打开,点击软件中间的大方框或者【添加文件】按钮,将需要修改名称的文件全部添加到软件中。
Ⅸ bat所有文件夹下的文件从001开始重新命名
文件批量重命名从001开始:
步骤1,下载上面的工具软件后打开四月,点击界面做上面的“添加文件”按钮,将需要进行批量重命名的文件全部添加到软件中。
Ⅹ 求BAT脚本批量重命名一个文件夹里面的文件为0001 、0002、0003、...依次0009到0010 ...0099 0100 0101!
以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI,跟要处理的文件放一起运行
@echo off
rem 将当前目录里的所有文件以指定位数的递增数字序号重命名
mode con lines=3000
set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%@% %z%
cd /d "%~dp0"
for /f "tokens=1*delims=:" %%a in ('dir /a-d/b^|find /i /v "%~nx0"^|findstr /n .*') do (
set "f=%%b"
set "fn=0000%%a"
setlocal enabledelayedexpansion
echo;"!f!" --^> "!fn:~-4!%%~xb"
endlocal
)
echo;%#% +%$%%$%/%@% %z%
pause
exit