【发布时间】:2017-12-01 20:28:34
【问题描述】:
-TheGame/
- Game files/
-> file1.whatever
-> file2.whatever
-> file3.whatever
-> Launcher.exe
-TheGameModed/
- Game files/
-> file1.whatever (the moded file)
-> Launcher.exe (the moded launcher)
我为游戏制作了一个模组,我想创建一个安装程序供人们玩我的游戏。 为了防止备份问题(如果玩家想恢复原版),我会将 mod 文件夹放在游戏文件夹旁边。 mod 文件夹仅包含“moded 文件”,并且想要制作一个批处理,该批处理将从游戏文件夹中复制目标中尚不存在的文件(即使不存在相同)
这样对吗:xcopy "../TheGame" "../TheGameModed" /q /s /e
这里有一个文档,但我没有找到我要查找的内容: https://www.computerhope.com/xcopyhlp.htm
我只找到了这个:
/U 仅复制目标中已存在的文件。 但我需要相反的(仅复制目标中不存在的文件)
附: : 当批量复制文件时,它会问我是否要覆盖,因为我只有很少的文件,所以输入 n 次并不难。但是如果有人输入 y(那会很糟糕),这个 mod 将被删除,也许下一个 mod 将包含更多文件:[
【问题讨论】:
-
你应该使用
/Y : Suppresses prompting to confirm you want to overwrite an existing destination file. -
echo N|xcopy "../TheGame" "../TheGameModed" /q /s /e -
@Hackoo - 这将默默地覆盖现有文件 - 与查询者的期望完全相反。
-
需要注意的是,
XCOPY已被严重弃用;你应该考虑使用ROBOCOPY,它有完全不同的选项。 -
@MisterAqua - 检查
ROBOCOPYFile Selection Options examples ROBOCOPY [file...] [选项] robocopy "C:\Source Folder*.*" "D:\Destination Folder*.*" /xx/xx Excludes extra files that exist in the destination directory
标签: windows batch-file