溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Powershell 批量重命名

發(fā)布時間:2020-07-28 19:44:18 來源:網(wǎng)絡(luò) 閱讀:3469 作者:cix123 欄目:系統(tǒng)運(yùn)維
先創(chuàng)建幾個用于測試的文件
$Directory = "C:\Test"
For($i=0;$i -le 10; ++$i) {
Set-Content -Path $("$Directory\Test($i).txt") -value $i 
}

創(chuàng)建結(jié)果如下圖:
Powershell 批量重命名

使用下面的命令把Test換成Mail

PS D:\> $Directory = "C:\Test"
PS D:\> Get-ChildItem $Directory | Rename-Item -NewName { $_.name -Replace "Test","Mail" }

結(jié)果如下圖:
Powershell 批量重命名

學(xué)習(xí)鏈接:

http://www.computerperformance.co.uk/powershell/powershell_replace.htm
http://www.pstips.net/bulk-renaming-files.html

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI