且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用文件夹名称重命名Powershell中的文件

更新时间:2023-02-14 21:06:01

这将重命名文件,并在文件夹名和文件名之间添加下划线('_'):

This will rename the files and put an underscore ('_') between the folder name and the file name:

Get-ChildItem C:\temp -Filter *.txt -Recurse | Rename-Item -NewName { $_.Directory.Name+'_'+$_.Name}