【问题标题】:Create an archive with current date and time in file name using 7z command line使用 7z 命令行在文件名中创建具有当前日期和时间的存档
【发布时间】:2013-02-09 16:40:47
【问题描述】:

今天我突然失去了我的整个孤岛惊魂 3 存档游戏。所以现在我想使用windows任务调度在一段时间内自动备份它的保存游戏文件夹。

我想在存档文件名中包含日期和时间。

这是我的命令

C:\>"C:\Program Files\7-Zip\7z" a -r "D:\FC3\%DATE:~7,2%.%DATE:~4,2%.%DATE:~-4% %TIME% Backup".7z  "C:\ProgramData\Orbit\46"

出于格式化目的,我关注了this question on superuser

执行此命令时我得到日志

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
Scanning

Creating archive D:\FC3\24.02.2013 17:52:10.62 Backup.7z

Error:
7-Zip cannot open file
D:\FC3\24.02.2013 17:52:10.62 Backup.7z
The filename, directory name, or volume label syntax is incorrect.

System error: Unspecified error

如果我使用像“D:\abc”这样的简单文件名。它会起作用的。

请帮忙。我哪里错了..?

【问题讨论】:

    标签: windows compression scheduled-tasks scheduling 7zip


    【解决方案1】:

    我明白了

    文件名不能有:

    我通过用.替换冒号来修复代码

    C:\>"C:\Program Files\7-Zip\7z" a -r "D:\FC3\%DATE:~7,2%.%DATE:~4,2%.%DATE:~-4% %TIME:~0,2%.%TIME:~3,2%.%TIME:~-5% Backup".7z  "C:\ProgramData\Orbit\46"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-18
      • 1970-01-01
      • 1970-01-01
      • 2015-06-18
      • 2018-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多