命令行范例
以下范例说明了使用“ntbackup”命令通过命令行或批处理文件备份文件或文件夹的方法。
范例 1:
ntbackup backup \\iggy-multi\c$ /m normal /j "My Job 1 " /p "Backup " /n "Command Line Backup 1 " /d "Command Line Functionality " /v:yes /r:no /l:s /rs:no /hc:on
该范例将执行名称为“My Job 1”的远程共享 \\iggy-multi\c$ 的正常备份。它将从媒体池取出一个磁带,并将其命名为“Command Line Backup 1”。对该备份作业的描述将是“Command Line Functionality”。只要完成备份作业就验证备份,访问权将不限于所有者/管理员,日志级别设成仅记录摘要,不备份远程存储数据,并且启用硬件压缩。
范例 2:
ntbackup backup d:\ /j "My Job 2 " /a /t "Command Line Backup 1 " /m copy
该范例将执行本地驱动器 D:\ 中名为“My Job 2”的副本备份。将备份的文件和文件夹附加在名为“Command Line Backup 1”的磁带上。所有其他选项将采用“备份”程序的默认值。
范例 3:
ntbackup backup "@C:\Program Files\Windows NT\ntbackup\data\commandline.bks " /j "My Job 3 " /t "Command Line Backup 1 " /n "Command Line Backup 2 "
该范例将使用在备份程序中指定的备份类型执行备份。它将使用位于 C:\Program Files\Windows NT\ntbackup\data\ 目录中名为 Commandline.bks 的备份选项文件来选择所要备份的文件。此项备份作业将命名为“My Job 3”,并以新名称“Command Line Backup 2”覆盖名为“Command Line Backup 1”的磁带。
范例 4:
ntbackup backup \\iggy-multi\d$ /j "Command Line Backup 4 " /f "D:\backup.bkf "
ntbackup backup \\iggy-multi\d$ /j "Command Line Backup 5 " /f "D:\backup.bkf " /a
ntbackup backup \\iggy-multi\d$ /j "Command Line Backup 6 " /f "D:\backup.bkf "
以上范例说明了使用命令行向文件中备份的方法。三个范例使用了包括备份类型、验证设置、日志级别、硬盘压缩和其他限制条件在内的备份程序默认值。第一个范例说明将 \\iggy-multi\d$ 备份到文件 D:\Backup.bkf 的方法,第二个范例说明了向同一文件附加同一备份的方法。第三个范例说明了使用相同备份覆盖文件的方法。在所有这三个范例中,完整的 UNC 名称可以替代驱动器号(即用户将 \\iggy-multi\d$\backup.bkf 而不是 d:\backup.bkf 指定为备份目标)。
==================================================================
付官方说明
Perform backup operations at a command prompt or from a batch file using the ntbackup command followed by various parameters.
ntbackup backup [systemstate] " @ FileName .bks " /J { " JobName "} [ /P { " PoolName "}] [ /G { " GUIDName "}] [ /T { " TapeName "}] [ /N { " MediaName "}] [ /F { " FileName "}] [ /D { " SetDescription "}] [ /DS { " ServerName "}] [ /IS { " ServerName "}] [ /A] [ /V:{ yes | no}] [ /R:{ yes | no}] [ /L:{ f | s | n}] [ /M { BackupType}] [ /RS:{ yes | no}] [ /HC:{ on | off}] [ /SNAP:{ on | off}]
Systemroot \System32\Ntmsdata
Systemroot \System32\Remotestorage
This ensures that all Removable Storage and Remote Storage data can be restored.
Following are four examples of how you can use the ntbackup command.
The following example performs a normal backup named "My Job 1" of the remote share \\iggy-multi\c$. This example pulls a tape from the Backup media pool, and name the tape "Command Line Backup 1." The description of the backup job is "Command Line Functionality." The backup is verified after the backup job is complete, access is not restricted to the owner/administrator, the logging level is set to summary only, Remote Storage data is not backed up, and hardware compression is enabled.
ntbackup backup \\iggy-multi\c$ /m normal /j "My Job 1" /p "Backup" /n "Command Line Backup 1" /d "Command Line Functionality" /v:yes /r:no /l:s /rs:no /hc:on
The following example performs a copy backup named "My Job 2" of the local drive D:\. The backed up files and folders are appended to the tape named "Command Line Backup 1." All other options default to those specified in the Backup program.
ntbackup backup d:\ /j "My Job 2" /a /t "Command Line Backup 1" /m copy
The following example performs a backup using the backup type that is specified in the Backup program. It uses the backup selection file named Commandline.bks, located in the C:\Program Files\Windows NT\ntbackup\data\ directory to choose which files to backup. The backup job is named "My Job 3" and it overwrites the tape named "Command Line Backup 1" with the new name "Command Line Backup 2."
ntbackup backup "@C:\Program Files\Windows NT\ntbackup\data\commandline.bks" /j "My Job 3" /t "Command Line Backup 1" /n "Command Line Backup 2"
The following examples show how to perform a backup to a file from the command line. All three examples use the Backup program's default values for the backup type, verification setting, logging level, hardware compression, and any other restrictions. The first example shows how to backup \\iggy-multi\d$ to the file D:\Backup.bkf. The second example shows how to append the same backup to the same file. The third example shows how to overwrite the file with the same backup. In all three examples a complete UNC name could be substituted for the drive letter (that is, instead of d:\backup.bkf, the user could specify \\iggy-multi\d$\backup.bkf as the backup destination).
ntbackup backup \\iggy-multi\d$ /j "Command Line Backup 4" /f "D:\backup.bkf"
ntbackup backup \\iggy-multi\d$ /j "Command Line Backup 5" /f "D:\backup.bkf" /a
ntbackup backup \\iggy-multi\d$ /j "Command Line Backup 6" /f "D:\backup.bkf"
Format | Meaning |
---|---|
Italic | Information that the user must supply |
Bold | Elements that the user must type exactly as shown |
Ellipsis (...) | Parameter that can be repeated several times in a command line |
Between brackets ([]) | Optional items |
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one |
Courier font |
Code or program output |