Run Command tool

Run Command Tool

Version:
Current
Last modified: June 11, 2020

Use Run Command to run external command programs within Designer. This tool can be used as an input, output, or an intermediary tool.

Alteryx Public Gallery Compatibility

Planning to publish your workflow to gallery.alteryx.com? You must first apply for an exemption. This restriction does not apply to private instances of Alteryx Server and Alteryx Gallery.

Using the Run Command tool is similar to running applications directly from the Windows command line, but with the convenience of remaining within the Alteryx GUI. For example, you can use the tool...

  • When Designer does not have needed functionality.
  • In conjunction with curl.exe to download data from web or FTP sites.
  • To call third party applications.
  • To wrap custom functionality written in other programming languages.

If the program you are using does not set error flags, you should wrap it in a batch file to make sure the output file is deleted before it is run.

Configure the Tool

When you run the workflow, the Run Command tool configuration is executed in sequence: Write Source, Run External Program, and then Read Results.

  1. Optionally specify a Write Source [Optional] output. The write source is data that comes into the tool as a file, SQL server connection, or any supported output type. Only specify a write source if you are using the Run Command tool as an output or intermediary tool.
  2. In the Run External Program section:
    • Specify the external program Command to run. For example, this could be a program that acts on a write source and generates read results.

      UNIX Operators

      If the external program is a UNIX-style command line app that takes input from stdin and writes to stdout, you can use the << and >> operators to pipe the information to and from files.

    • Enter the Command Arguments [Optional], if any. Most commands are used together with one or more arguments. Whether arguments are required or optional varies by command.
    • Optionally specify a Working Directory [Optional]. If you leave this field blank, the default is the directory where the workflow is saved.
    • Select Run Minimized to minimize the Run Command window to the taskbar when Alteryx executes the external command.
    • Select Run Silent to not display the Run Command window when Alteryx executes the external command.
  3. Optionally specify a Read Results input. This file is carried through the rest of the workflow. Only specify a read results input if you are using the Run Command tool as an input or intermediary tool.

Example Use Case

This example details an example use case and the resulting configuration.

1. The tool is configured as an input file in the Alteryx workflow. Therefore, leave Write Source blank.

Write source: (blank)

2. The Command is curl.exe, which is a free and open-source program that allows you to download files from a web page. For more information, visit the curl documentation.

Command: curl.exe

3. Command Arguments includes the complete path of the file you want to download as well as an output command and the file to output (in this case, -o "%temp%\temp.csv", which outputs the content from the web page as a file named temp.csv.

Command Arguments: http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=KCOBOULD10&month=6&day=19&year=2005&format=1 -o "%temp%\temp.csv"

4. Working Directory is left blank to default to the directory where the workflow is saved.

Working Directory: (blank)

5. Read Results refers to the temp.csv file to return from the downloaded content and its relative path (%temp% references the temporary directory). The curl program has already downloaded the content and is handling the data as this .csv file. Alteryx reads the .csv file as if it came from an Input Data tool. The file can now be processed downstream.

Read Results: %temp%\temp.csv

Was This Helpful?

Running into problems or issues with your Alteryx product? Visit the Alteryx Community or contact support.