I have to place a bunch of batch files on various servers for backup software installations. Is there a way to make the batch file run without specifying the path in each one? I've heard there's a way to do this but have been unsuccessful it finding out how.
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity



You can use %~DP0 to facilitate this.

%~DP0\backup.bat would replace \\server1\share1\backup.bat.

The command causes the file to be run from its relative path.

Hope this helps,

Answered 06/14/2007 by: dunnpy
Red Belt

Please log in to comment
Works like a charm!!! Thanks =)
Answered 06/14/2007 by: dpolishsensation
Blue Belt

Please log in to comment