0

Environment: I have two servers, ServerA and ServerB. ServerA stores my batch scripts and manages my Task Scheduler for automation. ServerB stores several .cmd and .bat files that must be added to the Task Scheduler on ServerA.

Issue: ServerB's .cmd files have local drive references as you'll see below. When called from ServerA's command line, they return errors because the command line is looking for them in ServerA instead of in ServerB. I cannot change these references because they have a considerable number of dependent pieces.

Code:

BatchA.bat:

pushd \\ServerB\d$
call Folder1\Folder2\Folder3\CommandB.cmd
popd

CommandB.cmd:

call D:\Folder1\Folder2\Folder3\batch1.bat
call D:\Folder1\Folder2\Folder3\batch2.bat
call D:\Folder1\Folder2\Folder3\batch3.bat
call D:\Folder1\Folder2\Folder3\batch4.bat

Question: How do I update BatchA.bat to properly call CommandB.cmd from ServerB?

Vincent Vance
  • 117
  • 1
  • 4
  • 13

1 Answers1

0

What you could do is map the local drive on ServerB to ServerA under the same drive letter that way when CommandB.cmd is called from ServerA it will have the drive it need and you wont need to change much.

In short you need to map \ServerB\d$ to drive letter D:\ on ServerA.

Badradish
  • 196
  • 1
  • 13
  • I wish this were possible. Unfortunately Server A's D drive is in use. – Vincent Vance Jul 23 '14 at 12:47
  • Does CommandB.cmd have to run on ServerA or would it matter if you run the CommandB.cmd on ServerB where it has its local Resources and pass the results back to ServerA ? – Badradish Jul 23 '14 at 13:31
  • As I think through it, this might be the best/easiest way of doing it. I'd prefer to have all of my batches kicked off on the same server to prevent having to keep track of what happens where. But solving this problem is taking so much time it might just be best to bite the bullet. – Vincent Vance Jul 23 '14 at 14:12