0

I want to write a batch file to execute a Cmd command with parameters:

@ECHO OFF
.\someCommand.exe /log verbose.log

If I only provide the log file without a directory, then, for an undetermined reason, the command writes the logfile into some temporary folder.

So if I want to have logging into the file verbose.log in the same directory the command is in, I would have to call:

.\someCommand.exe /log C:\full\path\to\this\directory\verbose.log

However, that full path changes from system to system, and I want a single batch file that works on all systems (as long as the batch file is in the same directory as the someCommand.exe). How can I get that path into that command line parameter?

Alexander
  • 19,906
  • 19
  • 75
  • 162
  • More information on the real executable, _name and location and perhaps whether it is in `%PATH%` and/or local to the batch file, run as Administrator etc._ would help. – Compo Apr 25 '18 at 16:22
  • 2
    To reference the folder the batch is in use `%~dp0verbos.log` To use the current path as in `.\someCommand` use `.\verbose.log` –  Apr 25 '18 at 16:25
  • @Alexander, if you know it is a duplicate question, wouldn't it be prudent to just delete your question? – Squashman Apr 25 '18 at 17:15

0 Answers0