简体   繁体   中英

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. It runs every time I start Windows and it runs again after 12 hours.

Problems are that it opens CMD and doesn't close it. 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.

Also after deleting the files from the backup location, it doesn't copy the files there anymore until I restart my 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?

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 . Then your script doesn't have to run 24/7.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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