删除文件名中的空格并将文件名从小写改为大写
在 Windows
中,我想从文件名中删除空格
,并将小写
更改为大写
。
file 1.txt --> FILE1.TXT
File 2.txt --> FILE2.TXT
Test 1.txt --> TEST1.TXT
我在命令提示符
上尝试了类似的操作(不起作用)
rename "*.txt" "*.TXT" # Works
rename "file*.txt" "FILE*.TXT"
rename "Test*.txt" "TEST*.TXT"
In Windows
, I want to remove white spaces
from file names and change the lower case
to upper case
.
file 1.txt --> FILE1.TXT
File 2.txt --> FILE2.TXT
Test 1.txt --> TEST1.TXT
I tried something like this (which is not working) on command prompt
rename "*.txt" "*.TXT" # Works
rename "file*.txt" "FILE*.TXT"
rename "Test*.txt" "TEST*.TXT"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如@Mofi 所说,
cmd
没有足够的能力来做到这一点。如果您使用的是受支持的 Windows 系统,则已随其安装了powershell
。当您确信文件将按预期重命名时,请从Rename-Item
命令中删除-WhatIf
。如果您迫切希望从
cmd
提示符或batch-file
运行它,可以使用它。As @Mofi said,
cmd
is not well equipped to do this. If you are on a supported Windows system,powershell
was installed with it. When you are confident that the files would be renamed as you expect, remove the-WhatIf
from theRename-Item
command.If you are desperate to run this from a
cmd
prompt orbatch-file
, this could be used.