I would like to automate the export of drawio-desktop as described here for Linux but under Windows. How would I do that as Windows doesn't have an exec command AFAIK?

Linux version: exec /usr/local/bin/draw.io --crop -x -o {}.pdf {} \

  • Can someone add [draw.io]? - I don't have enough rep.
    – leonheess
    Commented Jan 13, 2020 at 15:26

2 Answers 2


I figured it out:

C:\Program Files\draw.io\draw.io.exe C:\path\to\files\ --crop -x -o {}.pdf {} .

The syntax used in leonheess's self-answer is only valid when used within the -exec action of the Unix find utility; it is invalid syntax for Windows command lines as-is.

The standalone equivalent for Command Prompt is:

"C:\Program Files\draw.io\draw.io" -x -o . --crop -f pdf C:\path\to\files\

PowerShell is the same, but add & to the beginning. (see call operator)

-x will have drawio export files using the options that follow. -o . specifies the current directory for the output, with file names based on the input files. -f pdf specifies pdf as the output format, and output files will automatically get the .pdf extension.

C:\path\to\files\ will have drawio attempt to convert every file in that directory, regardless of its format or file extension. Error messages will print for each failed conversion, but drawio will continue, processing all files it discovers. These errors can be avoided by giving individual files instead:

"C:\Program Files\draw.io\draw.io" -x -o . --crop -f pdf C:\src\foo.drawio C:\src\bar.drawio

which will create foo.pdf and bar.pdf in the current directory.


"C:\Program Files\draw.io\draw.io" --help

for the official CLI help.

Tested on drawio version 23.0.2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .