KNOWLEDGE BASE

Tabcmd Export or Get Ignores Parameters When Run From a Batch File


Published: 27 May 2016
Last Modified Date: 07 Jul 2017

Issue

When running a .bat file to automate export of Tableau Server views, filter parameters are ignored when they contain spaces, or other characters requiring encoding.

For example, running a .bat script with the following export command results in a PDF generated for the original (unfiltered) view:

tabcmd export "Workbook/Sheet1?Order%20Priority=High&Customer%20Segment=Home%20Office" -s http://server-u user -p password --fullpdf -f "C:\export.pdf"

The tabcmd.log file shows that the resulting request is:

tabcmd export "Workbook/Sheet1?Order0Priority=High&Customer0Segment=Home0Office" -s http://server-u user -p password --fullpdf -f "C:\export.pdf"

Notice that the '%2' is stripped from the URL.

Environment

  • Tableau Server
  • .BAT file

Resolution

  • Escape any encoding using a second '%' character, like so:
tabcmd export "Workbook/Sheet1?Order%%20Priority=High&Customer%%20Segment=Home%%20Office" -s http://server-u user -p password --fullpdf -f "C:\export.pdf"

Cause

  • The Windows command interpreter, cmd.exe, works differently depending on whether a string is specified on the command line vs. inside a batch file.
  • Adding the second '%' to the encoding string instructs the command interpreter to look at the encoding string literally, instead of evaluating it as an argument.
Did this article resolve the issue?