如何從文字檔案的行重新命名檔案中的文件

如何從文字檔案的行重新命名檔案中的文件

我的腳本PowerShell:

$liste = get-content "Y:\Users\H\Documents\D\Game Of Throne\prod\recup.txt" `
         |Select-Object -last 1

$liste | ForEach-Object {Write-Host ($i++) $line}

get-childItem "Y:\Users\H\Documents\D\Game Of Throne\*.bmp*" `
       | rename-item -newname { $_.name -replace("aaa",$line)}

要重新命名的檔案範例:GameOfThrone aaa.bmp; GameOfThrone aaa(2).bmp ...

在文字檔中:

A
B
C

我希望我的文件命名如下:GameOfThrone A.bmp; GameOfThrone B.bmp ...

相關內容