0

I wrote a script to retry publishing several files (until the destination files arent in use) until it works. When It is done I would like to know when it finished them. I dont think anything is wrong with it, but why wont it pause at the end after copying? I made a pastie with the whole thing here

EDIT: New working code here)

PsychoData
  • 1,198
  • 16
  • 32
  • why? it just jumps back to right before the copy and tries copying again – PsychoData Feb 05 '14 at 00:02
  • I don't know about the `PAUSE`, but you have a lot of code duplication here. You could simplify this by using [`SHIFT`](http://ss64.com/nt/shift.html) and a loop. It would also allow for a great number of arguments. – jpmc26 Feb 05 '14 at 00:04
  • And what would be your suggested way of storing the times that each file was copied? – PsychoData Feb 05 '14 at 00:04
  • You're only printing them. Why not print them in the loop or build up a complete string to be printed later once? (Also, PowerShell provides much better support for lists. ;) ) – jpmc26 Feb 05 '14 at 00:08
  • I want them to all be easily findable, so the end seemed the logical choice for printing them, so that they would be grouped. How might one build all of them up into a string without smushing everything onto a single line? – PsychoData Feb 05 '14 at 00:10
  • That's a different question. See [here](http://stackoverflow.com/questions/7041069/dos-working-with-multi-line-strings). – jpmc26 Feb 05 '14 at 00:15
  • does [this](http://pastie.org/private/ryncil3pkhia5bthls3oia) seem more satisfactory? and the pause works now, but I have no idea why...... – PsychoData Feb 05 '14 at 00:49
  • That is much, much simpler. =) – jpmc26 Feb 05 '14 at 00:54
  • thanks for forcing me to make my code better :) – PsychoData Feb 05 '14 at 00:58

1 Answers1

0

The true answer to why the pause never ran may never be known, but I did get my code working with +jpmc26 s suggestion of a multiline string. Once that was working as expected, the pause mysteriously worked again. Original Code here new, working code here

PsychoData
  • 1,198
  • 16
  • 32