.bat文件以重命名并在提示符下移动文件 [英] .bat file to rename and move files with prompt

查看:77
本文介绍了.bat文件以重命名并在提示符下移动文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对此我完全陌生,但是我尝试创建一个 .bat 文件,该文件允许我重命名指定文件夹中的一对文件并将它们移到子文件夹中.我遇到的问题是我想提示您识别/选择要重命名和移动的文件.

I am completely new to this, but I am trying to create a .bat file that will allow me to rename a pair of files within a designated folder and move them into a subfolder. The part I am having trouble with is that I am wanting a prompt to come up to identify/select the files to be renamed and moved.

示例文件名是:

A1234, A1235, A1236, B1234, B1235, B1236, etc.

是否可以弹出提示,允许用户键入文件的共享名称(例如1234),然后将两个文件重命名并将其移动到指定的子文件夹?

Is there a way to bring up a prompt that allows the user to type the shared name (ex 1234)of the files and rename and move both files to the designated subfolder?

任何人和所有帮助将不胜感激!

Any and all help would be appreciated!

推荐答案

去这里

@echo off
set /p file=Please type shared name: 
for %%a in (C:\Folder\?%file%.*) do (
move "%%a" subdir
ren "subdir\%%a" newname.*
)

这篇关于.bat文件以重命名并在提示符下移动文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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