用BAT文件重命名文件名 [英] Renaming file names with a BAT file

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

问题描述

需要在Windows 7的单个文件夹中编辑一组视频文件的文件名.

Need to edit the file names of set of video files in a single folder in Windows 7.

有兴趣对文件名集进行以下修改

Interested in a simple way to do the following modification to set of file names

替换."字符为"x"

Replace the "." with the character "x"

eg. 
   original: 04.19 - Lady & Peebles.mp4
   renamed:  04x19 - Lady & Peebles.mp4

使用批处理文件手动执行此操作的合适方法是什么?

What is a suitable way to do this manually using a Batch file?

推荐答案

像这样尝试

@echo off
setlocal EnableDelayedExpansion
for /f "delims=" %%a in ('dir /a-d/b *.mp4') do (
    set "$File=%%~na"
    echo ren "%%a" "!$file:.=x!%%~xa"
)

包含了echo,以便您可以测试输出.如果可以的话,将其删除.

The echo is included so that you can test the output. If it's OK remove it.

这篇关于用BAT文件重命名文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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