回答如何使用txt中给定的名字批量重命名


Get-Content .\FileNameMap.txt | foreach {
$source,$newName = $_ -split ' '
if(Test-Path $source){
Rename-Item -Path $source -NewName $newName
}
else{
Write-Host "$source 路径不存在" -ForegroundColor Red
}
}

关于 Mooser Lee

我是一个Powershell的爱好者,创建了PowerShell中文博客,热衷于Powershell技术的搜集和分享。本站部分内容来源于互联网,不足之处敬请谅解,并欢迎您批评指正。