Windows XP 中用于复制粘贴文件夹的 .bat 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6036407/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 16:52:13  来源:igfitidea点击:

.bat file for copy-pasting folder in Windows XP

windowsbatch-filecopy-paste

提问by Maddy

I need to copy-paste a folder (files + subfolders) into a BackUpfolder. I also need to append the time into the BackUp folder name. xcopycommand is letting me copy only files. Your help would be appreciated.

我需要将文件夹(文件 + 子文件夹)复制粘贴到 BackUpfolder 中。我还需要将时间附加到备份文件夹名称中。xcopy命令让我只复制文件。您的帮助将不胜感激。

Source Folder = "C:\Documents and Settings.....\Project"(has many files + subfolders) Target Folder = "C:\Backup-Date/time of backup"Eg Bacup:May 16 2011 12:30 AM

源文件夹 = "C:\Documents and Settings.....\Project"(有很多文件 + 子文件夹)目标文件夹 ="C:\Backup-Date/time of backup"例如 Bacup:2011 年 5 月 16 日上午 12:30

I plan to run this bat file through Scheduler. Thanks!

我打算通过调度程序运行这个 bat 文件。谢谢!

回答by Luis Tellez

XCOPY

复制

Copy files and/or directory trees to another folder. XCOPY is similar to the COPY command except that it has additional switches to specify both the source and destination in detail.

将文件和/或目录树复制到另一个文件夹。XCOPY 类似于​​ COPY 命令,除了它有额外的开关来详细指定源和目标。

XCOPY is particularly useful when copying files from CDROM to a hard drive, as it will automatically remove the read-only attribute.

XCOPY 在将文件从 CDROM 复制到硬盘驱动器时特别有用,因为它会自动删除只读属性。

Syntax XCOPY source [destination] [options]

语法 XCOPY source [destination] [options]

/S Copy folders and subfolders

/S 复制文件夹和子文件夹

/E Copy folders and subfolders, including Empty folders. May be used to modify /T.

/E 复制文件夹和子文件夹,包括空文件夹。可用于修改/T。

/H Copy hidden and system files and folders (default=N) Key source : Pathname for the file(s) to be copied.

/H 复制隐藏和系统文件和文件夹(默认值=N) 关键源:要复制的文件的路径名。

destination : Pathname for the new file(s).

目的地:新文件的路径名。

There are several options you can look at :http://ss64.com/nt/xcopy.html

您可以查看几个选项:http://ss64.com/nt/xcopy.html

Soruce: http://ss64.com/nt/xcopy.html

来源:http: //ss64.com/nt/xcopy.html

回答by Mr47

I think reading the documentation of xcopy would go a long way.

我认为阅读 xcopy 的文档会大有帮助。