将所有文件重命名为小写,替换空格 [英] Rename all files to lowercase, replace spaces

查看:60
本文介绍了将所有文件重命名为小写,替换空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows命令提示符下,如何将所有文件重命名为小写并删除所有空格?

In a Windows command prompt, how can I rename all the files to lower case and remove all spaces?

推荐答案

制作批处理文件

@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%i in ( ' dir /b /a-d *.* ') do (
set name="%%i"
set newname=!name: =!
rename "%%i" !newname!
)

注意:在测试目录下运行,查看是否具有预期的功能结果。我尚未测试过。

NOTE: Run under a test directory and see if you have the expected result. I have not tested it.

编辑:忘了说这只会删除空格。

Forgot to say this will only remove the spaces.

这篇关于将所有文件重命名为小写,替换空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆