简体   繁体   English

运行批处理文件后,CMD没有关闭,删除文件后文件没有复制?

[英]CMD doesn't close after I run a batch file and files don't copy after deleting them once?

I made a batch file to copy my Witcher 3 save files and settings to another drive. 我制作了一个批处理文件,将我的Witcher 3保存文件和设置复制到另一个驱动器。 It runs every time I start Windows and it runs again after 12 hours. 它每次启动Windows时运行,并在12小时后再次运行。

Problems are that it opens CMD and doesn't close it. 问题是它打开CMD并且不关闭它。 I wan't it to close automatically, it doesn't matter if it shows deleting and copying the files I would actually prefer it showing those, just close automatically after those and don't show the seconds its counting for 12 hours. 我不想自动关闭,如果它显示删除和复制文件并不重要我实际上更喜欢它显示那些,只是在那些之后自动关闭并且不显示其计数12小时的秒数。

Also after deleting the files from the backup location, it doesn't copy the files there anymore until I restart my PC. 此外,在从备份位置删除文件后,它不再复制文件,直到我重新启动PC。

I made the batch file to delete the files because it would just copy the new files and leave the old ones in and it would be a mess, so I'm not sure if I could do this only with the copy command and without the del command? 我制作了批处理文件来删除文件,因为它只是复制新文件并保留旧文件,这将是一个烂摊子,所以我不确定我是否只能使用copy命令和没有del这样做命令?

The batch file looks like this: 批处理文件如下所示:

:loop

del /s /q "F:\\Backups\\The Witcher 3 save files"

xcopy /m /e /y "C:\\Users\\Kristian\\Documents\\The Witcher 3" "F:\\Backups\\The Witcher 3 save files"

timeout /t 43200

goto loop

If you want a batch file to run every 12 hours, you should use the Windows Task Scheduler . 如果要每12小时运行批处理文件,则应使用Windows任务计划程序 Then your script doesn't have to run 24/7. 然后你的脚本不必全天候运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM