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?
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.