如何批量覆盖已有文件?

发布于 2024-09-29 07:33:53 字数 104 浏览 1 评论 0原文

以下命令复制并移动文件,但我还需要它来覆盖它要替换的文件。

xcopy /s c:\mmyinbox\test.doc C:\myoutbox

The following command copies and moves a file but I also need it to overwrite the file it's replacing.

xcopy /s c:\mmyinbox\test.doc C:\myoutbox

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

双马尾 2024-10-06 07:33:53

将 /Y 添加到命令行

Add /Y to the command line

风吹短裙飘 2024-10-06 07:33:53

您可以使用:

copy /b/v/y

请参阅COPY 上的 SS64

You can use :

copy /b/v/y

See SS64 on COPY.

杀手六號 2024-10-06 07:33:53

xcopy命令行中添加/y

示例:

xcopy /y c:\mmyinbox\test.doc C:\myoutbox

Add /y to the command line of xcopy:

Example:

xcopy /y c:\mmyinbox\test.doc C:\myoutbox
蔚蓝源自深海 2024-10-06 07:33:53

您只需添加 /Y

xcopy /s c:\mmyinbox\test.doc C:\myoutbox /Y

,如果您使用带空格的路径,请尝试此

xcopy /s "c:\mmyinbox\test.doc" "C:\myoutbox" /Y

you need to simply add /Y

xcopy /s c:\mmyinbox\test.doc C:\myoutbox /Y

and if you're using path with spaces, try this

xcopy /s "c:\mmyinbox\test.doc" "C:\myoutbox" /Y
失退 2024-10-06 07:33:53

为了将一个文件复制到另一个目录并在没有任何提示的情况下进行覆盖,我最终使用了简单的 COPY 命令:

copy /Y ".\mySourceFile.txt" "..\target\myDestinationFile.txt"

For copying one file to another directory overwriting without any prompt i ended up using the simply COPY command:

copy /Y ".\mySourceFile.txt" "..\target\myDestinationFile.txt"
回忆那么伤 2024-10-06 07:33:53

如果从批处理作业中运行复制命令,则无需使用 /Y 开关:它将覆盖现有文件。

If the copy command is run from within a batch job you do not need to use the /Y switch: it will overwrite existing files.

Oo萌小芽oO 2024-10-06 07:33:53

在任何情况下都会复制的命令

xcopy "path\source" "path\destination" /s/h/e/k/f/c/y

A command that would copy in any case

xcopy "path\source" "path\destination" /s/h/e/k/f/c/y
不爱素颜 2024-10-06 07:33:53

如果目标文件是只读的,请使用 /y/r

xcopy /y/r source.txt dest.txt

If destination file is read only use /y/r

xcopy /y/r source.txt dest.txt
毁我热情 2024-10-06 07:33:53

以下是我在批处理脚本中将文件从 B:\ 复制并覆盖到 Z:\ 驱动器的方法。

echo F| XCOPY B:\utils\MyFile.txt Z:\Backup\CopyFile.txt /Y

末尾的“/Y”参数将覆盖目标文件(如果存在)。

Here's what worked for me to copy and overwrite a file from B:\ to Z:\ drive in a batch script.

echo F| XCOPY B:\utils\MyFile.txt Z:\Backup\CopyFile.txt /Y

The "/Y" parameter at the end overwrites the destination file, if it exists.

灼痛 2024-10-06 07:33:53

您可以使用以下命令参考Windows命令提示符帮助:xcopy /?

You can refer Windows command prompt help using following command : xcopy /?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文