How to Run After Effects Scripts from Command Line

If you are familiar with how to run a script from the command line in Windows, you can send a script directly to the open After Effects application, so that the application automatically runs the script.

To run a script from the command line, call afterfx.exe from the command line. Use the -r switch and the full path of the script to run as arguments. This command does not open a new instance of the After Effects application; it runs the script in the existing instance.

Run After Effects Scripts from Command Line

Running After Effects Scripts from Command Line

Example (for Windows)

afterfx -r c:\script_path\example_script.jsx

You can use this command-line technique—together with the software that comes with a customizable keyboard—to bind the invocation of a script to a keyboard shortcut.

Following are examples of Windows command-line entries that will send an After Effects script to the application without using the After Effects user interface to execute the script.

In the first example, you copy and paste your After Effects script directly on the command line and then run it. The script text appears in quotation marks following the afterfx.exe -s command:

afterfx.exe -s “alert(“You just sent an alert to After Effects”)”

Alternatively, you can specify the location of the JSX file to be executed. For example:

afterfx.exe -r c:\myDocuments\Scripts\yourAEScriptHere.jsx
afterfx.exe -r “c:\myDocuments\Scripts\Script Name with Spaces.jsx”