简体   繁体   English

将所有文件重命名为.txt

[英]RENAME ALL FILES TO .txt

I am trying to rename all file to.txt, i have tried selecting all and renaming it only changes the name and not the extension.我正在尝试将所有文件重命名为.txt,我尝试选择全部并重命名它只会更改名称而不是扩展名。

Get-childitem
Rename-Item c:\temp\*.* *.txt
Get-ChildItem C:\Temp\*.* | Rename-Item -NewName { $_.BaseName + ".txt" } -WhatIf

-WhatIf is for confirming if the rename is correct or not. -WhatIf用于确认重命名是否正确。 Remove that to do the real renaming删除它以进行真正的重命名

You can try:你可以试试:

Get-ChildItem c:\temp\*.* | Rename-Item -NewName { $_.Name -replace $_.Extension,'.txt' }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM