我有一个 1TB 的 USB 驱动器,我用它作为工作电脑的备份驱动器。
驱动器最终将耗尽空间,我需要进入并使用管理空间/查看备份对话框删除旧备份并删除过去时期的备份。
有没有什么方法可以告诉 Windows Backup 以更智能的方式管理备份空间并保留尽可能多的备份,但不会超出驱动器大小并发出错误?
答案1
我编写了这个脚本,每周运行一次:
wbadmin delete backup -keepversions:7 -quiet
简单,发射后就不管。
答案2
保留最新的 3 个备份:
wbadmin delete backup -keepversions:3 -quiet
- 打开记事本并输入以下行。
- 将文件保存为 remove-old-backups.bat
- 打开任务计划程序(Windows 10)
- 右键点击“创建任务”
- [常规]:填写描述
- [触发器] > [新建] > [按计划] > [每周] … (每周运行)
- [操作] > [新建] > [启动程序] > 选择您的 .bat 文件
这样就可以了。
命令信息:
wbadmin delete backup /?
wbadmin 1.0 - Backup command-line tool
(C) Copyright 2013 Microsoft Corporation. All rights reserved.
ERROR - Command syntax incorrect. Error: /?. See the command
syntax below.
Syntax: WBADMIN DELETE BACKUP
{-keepVersions:<No. of copies> | -version:<VersionIdentifier> | -deleteOldest}
[-backupTarget:<VolumeName>]
[-machine:<BackupMachineName>]
[-quiet]
Description: Deletes the backups that you specify. If the
specified volume contains backups other than backups of the local
server, those backups will not be deleted.
To use this command, you must be a member of the Backup Operators group
or Administrators group.
Parameters:
-keepVersions Specifies the number of the latest backups to
keep. The value must be a positive integer. The option value
-keepVersions:0 deletes all the backups.
-version Version identifier of the backup in MM/DD/YYYY-HH:MM format.
If you do not know the version identifier, at a command
prompt, type: WBADMIN GET VERSIONS. Versions that are
exclusively backups can be deleted using this
command. Use WBADMIN GET ITEMS to view the version type.
-deleteOldest Deletes the oldest backup.
-backupTarget Specifies the storage location for the backup that you want
to delete. The storage location for backups is a
drive letter, a mount point, or a GUID-based volume path. This
value only needs to be specified for locating backups that are
not of the local computer. Information about backups for the
local computer will be available in the backup catalog on the
local computer.
-machine Specifies the computer whose backup you want to
delete. Useful when multiple computers were backed up to
the same location. Should be used when -backupTarget is
specified.
-quiet Runs the command with no prompts to the user.
Remarks: One, and only one, of these parameters must be specified:
-keepVersions, -version, or -deleteOldest.
Examples:
WBADMIN DELETE BACKUP -version:03/31/2006-10:00
WBADMIN DELETE BACKUP -keepVersions:3
WBADMIN DELETE BACKUP -backupTarget:f: -deleteOldest
答案3
这有点老套,但答案是:不。Windows(7)备份不会自动删除旧备份,也没有(自动)执行此操作的能力。
如果您需要,则首选第三方备份工具。