當前位置:首頁 » 文件管理 » bat重命名文件夾

bat重命名文件夾

發布時間: 2022-10-04 08:18:27

A. 如何使用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;
}
}
}
}

B. 如何用bat命令重命名文件夾

ren"d:123321""421"

有疑問,請追問!

C. 求bat給所在文件夾的文件進行批量替換符號重命名

不清楚你的實際文件/情況,僅以問題中的說明及猜測為據;以下代碼復制粘貼到記事本,另存為xx.bat,編碼選ANSI,跟要處理的文件或文件夾放一起雙擊運行

/*&cls&echooff&cd/d"%~dp0"&modeconlines=5000
rem將多個mp4文件名稱開頭的指定特徵字元刪除,並添加所在文件夾名稱前綴字元
set#=Anyquestion&set_=WX&set$=Q&set/az=0x53b7e0b4
title%#%+%$%%$%/%_%%z%
dir/a-d-h/b/s*.mp4|cscript-nologo-e:jscript"%~f0"
echo;%#%+%$%%$%/%_%%z%
pause
exit
*/
varfso=newActiveXObject('Scripting.FileSystemObject');
while(!WSH.StdIn.AtEndOfStream){
varit=WSH.StdIn.ReadLine();
varfile=fso.GetFile(it);
vartmpname=file.Name.replace(/^d+*[-_]*/,'');
if(tmpname!=file.Name){
varnewname=file.ParentFolder.Name+'-'+tmpname;
WSH.StdErr.WriteLine(it+'-->'+newname);
}
}

D. bat所有文件夾下的文件從001開始重新命名

文件批量重命名從001開始:

步驟1,下載上面的工具軟體後打開四月,點擊界面做上面的「添加文件」按鈕,將需要進行批量重命名的文件全部添加到軟體中。

E. 求bat給所在文件夾的文件進行批量替換符號重命名

不清楚你的實際文件/情況,僅以問題中的樣例說明及猜測為據;以下代碼復制粘貼到記事本,另存為xx.bat,編碼選ANSI,跟要處理的文件或文件夾放一起雙擊運行

/*&cls&echooff&cd/d"%~dp0"&modeconlines=5000
rem將多個mp4文件名稱開頭的指定特徵字元刪除,並添加所在文件夾名稱前綴字元
set#=Anyquestion&set_=WX&set$=Q&set/az=0x53b7e0b4
title%#%+%$%%$%/%_%%z%
dir/a-d-h/b/s*.mp4|cscript-nologo-e:jscript"%~f0"
echo;%#%+%$%%$%/%_%%z%
pause
exit
*/
varfso=newActiveXObject('Scripting.FileSystemObject');
while(!WSH.StdIn.AtEndOfStream){
varit=WSH.StdIn.ReadLine();
varfile=fso.GetFile(it);
vartmpname=file.Name.replace(/^d+*[-_]*/,'');
if(tmpname!=file.Name){
varnewname=file.ParentFolder.Name+'-'+tmpname;
WSH.StdErr.WriteLine(it+'-->'+newname);
}
}

F. bat批量重命名文件(在子文件夾里)

方法/步驟如下:

1、新建一個Excel文件,將原文件名、修改後文件名按照圖片中格式,輸入到表中。(行數不限)

5、完成。


G. 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;
}
}

H. 求助大神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'';
}
}

I. 怎麼用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%"

熱點內容
數控折彎機如何編程 發布:2024-10-08 20:34:40 瀏覽:58
pod內部修改配置如何生效 發布:2024-10-08 20:25:33 瀏覽:234
重慶伺服器託管市場低價雲主機 發布:2024-10-08 20:23:39 瀏覽:361
運維接觸源碼 發布:2024-10-08 19:55:44 瀏覽:485
python怎麼輸出換行 發布:2024-10-08 19:42:19 瀏覽:416
dhcp伺服器源碼 發布:2024-10-08 19:42:07 瀏覽:737
Sql88 發布:2024-10-08 19:01:55 瀏覽:969
汽車參數配置怎麼看乾式離合 發布:2024-10-08 18:57:47 瀏覽:796
編譯器設計圖 發布:2024-10-08 18:53:36 瀏覽:189
x7買哪個配置的比較好 發布:2024-10-08 18:48:25 瀏覽:772