My bat shall move a couple of folders, but there is one specific folder that will sometimes get moved, sometimes not for no particular reason.

move "%~dp0\source" "%ALLUSERSPROFILE%\target" >NUL

The bat gets executed automatically after the self-extraction of an archive and is run with elevation. The destination folder gets deleted (if exists) beforehand so there aren't any conflicts with already existing folders.

Any ideas to why this could happen?

Edit: If I put pauses in the script it seems to work .. do I have to wait after each step? Seems silly

  • Put some timeout in the batch after arch extraction. – Overmind Jun 30 '16 at 9:25
  • @Overmind batch itself does not contain the extraction. Batch gets called by the sfx module of 7zip after extraction. You think a timeout at the top of the batch would help? – taclight Jun 30 '16 at 9:33
  • Yes, start it with a timeout of a few seconds, so files don't get write-caching or other interference. – Overmind Jun 30 '16 at 9:38
  • @Overmind what waiting time would be sufficient? – taclight Jun 30 '16 at 9:40
  • 1
    @barlop >NUL redirects standard output not standard error. I also tested it without. Remove your -1. – taclight Jun 30 '16 at 10:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.