小编I g*_* it的帖子

UpperCase只有文件夹中所有文件名的前两个字母?

我知道我可以使用以下内容将给定文件夹中的所有文件名转换为大写:

Get-ChildItem -Path your_path -Recurse | Rename-item -NewName {$_.name.ToUpper()}
Run Code Online (Sandbox Code Playgroud)

但是,如何只将文件夹中所有文件名的前两个字母大写?

即

ls 123456_This_is_a_Test.pdf - > LS 123456_This_is_a_Test.pdf

re 98765_Another_Test.pdf - > RE 98765_Another_Test.pdf

谢谢丹

powershell

3
推荐指数
1
解决办法
274
查看次数

标签 统计

powershell ×1