批处理文件创建备份和时间戳重命名 [英] Batchfile to create backup and rename with timestamp

查看:602
本文介绍了批处理文件创建备份和时间戳重命名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将文件复制到存档文件夹下面的网络路径。它复制文件1 文件夹存档但我会想补充这两个调整,这是行不通的。


  1. 重命名文件1-1 文件1 - 日期+时间

  2. 现在,运行它显示与复制code一个cmd中,有没有可能
    在后台运行,或有加载屏幕显示
    进展如何?

有关我的code我跟着这个例子,以将名称更改为一个日期。

 复制F:\\文件夹\\文件1.xlsxF:\\文件夹\\存档\\文件1-1.xlsx
/ F令牌= 1-5 DELIM S = /%%的(%DATE%)D不重命名F:\\文件夹例如2.xlsxF:\\文件夹\\文件例如%%ë - %%的F - %% g.xlsx


解决方案

试试这个:

 仁文件1-1文件1  - %日期:/ =  - %%的时间:: =  - %

I have the following network path to copy the file to an archive folder. It copies File 1 from Folder to Archive but I would like to add these 2 adjustments that won't work.

  1. Rename File 1-1 to File 1 - date + time
  2. Running it now displays a cmd box with the copy code, is it possible to run it in the background or have a loading screen to show the progress?

For my code I followed this example to change the name to a date.

copy "F:\Folder\File 1.xlsx" "F:\Folder\Archive\File 1-1.xlsx"
/f "tokens=1-5 delim s=/ " %%d in ("%date%") do rename "F:\Folder example 2.xlsx" "F:\Folder\File example %%e-%%f-%%g.xlsx"

解决方案

try this:

ren "File 1-1" "File 1 - %date:/=-% %time::=-%"

这篇关于批处理文件创建备份和时间戳重命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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