1

I have a simple BAT file I run to copy files from one folder to 8 different folders. Then again to 8 different folders on a remote file server.

It looks like all the files are copied but it I have a pause at the end so I can see what files were copied. Before the files are copied to the remote file server there are a number of blank lines and I guess that is because it's taking some time to access the remote file server but they are in the middle of the last local file copy and at times the end of one copy command will be added to the middle of the pervious command.

This section in the BAT file.

Copy "C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\CONTROL ROOM PROGRAM*.aaPKG" "C:\NewLocal\New Updated InTouch Applications 2022-2023\InTouch 2014 R2 SP1 - 11.1.13100\Control Room"
Copy "C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\POLE PC*.aaPKG" "C:\NewLocal\New Updated InTouch Applications 2022-2023\InTouch 2014 R2 SP1 - 11.1.13100\Pole PC"
Copy "C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\4D4*.aaPKG" "C:\NewLocal\New Updated InTouch Applications 2022-2023\InTouch 2020 R2 SP1 - 20.1.100\4D4"
Copy "C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\PTCU2*.aaPKG" "C:\NewLocal\New Updated InTouch Applications 2022-2023\InTouch 2020 R2 SP1 - 20.1.100\PTCU2"
Copy "C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\WEST*.aaPKG" "C:\NewLocal\New Updated InTouch Applications 2022-2023\InTouch 2020 R2 SP1 - 20.1.100\WEST"

Looks like this in the running CMD window.

C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move>Copy "C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\CONTROL ROOM PROGRAM*.aaPKG" "C:\NewLocal\New Updated InTouch Applications 2022-2023\InTouch 2014 R2 SP1 - 11.1.13100\Control Room"
C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\CONTROL ROOM PROGRAM_04-26-2023.aaPKG
        1 file(s) copied.

C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move>Copy "C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\POLE PC*.aaPKG" "C:\NewLocal\New Updated InTouch Applications 2022-2023\InTouch 2014 R2 SP1 - 11.1.13100\Pole PC"
C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\POLE PC_04-26-2023.aaPKG
        1 file(s) copied.


















C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\WEST*.aaPKG
The system cannot find the file specified.
        0 file(s) copied.

Other times I've seen it put the output of one copy command in the middle of the one before.

So this.

C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move>Copy "C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\POLE PC*.aaPKG" "C:\NewLocal\New Updated InTouch Applications 2022-2023\InTouch 2014 R2 SP1 - 11.1.13100\Pole PC"
C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\POLE PC_04-26-2023.aaPKG
        1 file(s) copied.

Ends up something like this.

C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move>Copy "C:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\POLE PC*.aaPKG" "C:\NewLocal\New Updated InToC:\Users\LocalUser\Desktop\JHU InTouch Backups To Move\WEST*.aaPKG

I tried putting a pause after each copy command and stepping through it. Each copy command is then listed in full but I have to press the any key for each file copy. Again, it seems to work but make me wonder if something is wrong with the PC or the BAT file.

Compo
  • 36,585
  • 5
  • 27
  • 39
Tanquen
  • 33
  • 8
  • 3
    I'll admit I've seen similar when some of my long-time proved batches run. For me, it's occasional and I've found no pattern beyond the only cure appears to be to close the `cmd` window and start a new session. There always appears to be a few lines at the top of the window and another few at the bottom, separated by blank space. I've not found a way to clear the lines at the end of the window. To be fair, I've not really tried - leaning on the `enter` button does not clear the rogue lines. It appears as though `cmd` is losing track of the line count. And it appears recent-last few weeks. – Magoo Apr 26 '23 at 18:33
  • [Similar question with an accepted answer](https://stackoverflow.com/questions/76212490/ascii-art-gets-bugged-1-out-of-10-15-times-when-i-open-my-batch-file) (explanation only, no solution (yet)) – Stephan May 30 '23 at 17:56

0 Answers0