darktable-cli path definition on Windows

(Peter Cherry) #1

I am using this command for developing RAW files in Windows batch file.

darktable-cli “%~dpnx1” “c:\files\Darktable\darktable.xmp” “c:\darktable_export\%~n1.jpg”

I would like to save JPG into the same folder as RAW file is, but %~dpnx1 is not working for output.
In fact I need to replace c:\darktable_export\ by path of the source file.

Thanks for help


I don’t know what %~dpnx1 is doing, but you can use darktable’s export variables in darktable-cli, too. So in your case you might want to use

darktable-cli  "%~dpnx1" "c:\files\Darktable\darktable.xmp" "$(FILE_FOLDER)/$(FILE_NAME).jpg"

Depending on the shell used you might have to escape the $ to become \$. It might also be that the version you tried would work if you used \\ or / as path separators.


@P_Cherry My go-to reference is https://ss64.com/nt/syntax-args.html. In CMD.exe command line, you use single %s, but in batch files, you need to double them %%. If this is the only command you are doing, I suggest that you use a for loop directly in CMD:

for %i in (*.CR2) do darktable-cli %i %i.xmp %~ni.jpg
  • Replace the CR2 extension with your raw format’s.
  • Replace %i.xmp if you are using only one XMP.

(Peter Cherry) #4

@houz: Perfect, it really works with $(FILE_FOLDER)/$(FILE_NAME)
Many thanks