Starting ANSYS Products From the Command Line


Editor’s Note (1/23/2022): It’s time to update this article on launching from the command line. After we moved our website to its new home, we started tracking which blog posts were popular. And it turns out that this post is one of the top 10 posts that people are still accessing, having hundreds of visits a week from around the world. However, it is over ten years old. So we have taken the time to update the post to be correct for Ansys version 2022R1. We have also included information for newer products. The original content is down at the bottom for reference.

The need to run from the command line has not changed since we originally published this post in 2012. And most of the options are the same. Some things are simpler, there are some new command line options, and there are a lot more products in the Ansys family. In this post, we will cover the basics for launching from the command line for the flagship products and also share where you can learn more in the Ansys documentation.

One of the big changes over the past years is the use of Python or 3rd party programs to run Ansys solvers for you. Maybe you are doing a multi-tool optimization or a digital twin. Or maybe you created a vertical application that runs Ansys solvers in the background. In such cases, you will be launching the executables from your program or script, and the path and the options are critical for this.

A Word About Paths

When you execute a program on Windows or Linux, you have to tell the operating system where the executable is that you want to run. This is called the path. As an example, Ansys MAPDL is located here for 2022R1:

C:\Program Files\ANSYS Inc\v221\ansys\bin\winx64\MAPDL.EXE

If things are not working, it could be because of paths. Most of that has been fixed in recent versions of Ansys, but it could be a problem. Scroll down to the section on paths in the original articles to learn details on what this means and how to do it. That has not changed since 2012 (actually, its been the same since 2002 or so). In most cases, just use the full path to run the program, as in the examples below.

Not having the right path specified in the command or as an environment variable is the number one reason why people have trouble running the program executables. So before you contact support or start digging deeper into the documentation, make sure your paths are correct. For windows, I do this with a dir command or ls for Linux. Open a command prompt and type the path you want to use with dir in front. Make sure you put the full path in quotes! The OS doesn’t like spaces. This is for Ansys 2021 R2 on Windows:

C:\>dir "C:\Program Files\ANSYS Inc\v212\ansys\bin\winx64\ANSYS.EXE"
 Volume in drive C is Local Disk
 Volume Serial Number is 28D0-C244

 Directory of C:\Program Files\ANSYS Inc\v212\ansys\bin\winx64

06/01/2021  03:25 PM       502,828,168 ANSYS.exe
               1 File(s)    502,828,168 bytes
               0 Dir(s)  70,295,326,720 bytes free

If you have the wrong path, you will get “File not Found:”

C:\>dir "C:\Program Files\ANSYS Inc\v212\ansys\bin\ANSYS.EXE"
 Volume in drive C is Local Disk
 Volume Serial Number is 28D0-C244

 Directory of C:\Program Files\ANSYS Inc\v212\ansys\bin

File Not Found

Linux is almost the same. This simple test can save you a lot of time in debugging your scripts.

Also note, you will need to change your path with each version of the program.

Ansys Mechanical APDL

Let’s start with launching the original ANSYS program itself. The executable that started it all, MAPDL.exe. When you solve Ansys Mechanical, it is running Ansys Mechanical APDL as a separate process.

The executable is now goes by three names, all work:

  • mapdl.exe
  • ansysYYN, where YY= the two-digit version year and N is the release number,
  • ansysYYYYrN where YYY is the four digit year and N is the release number.

So Ansys 2022R2 is ansys222. I prefer to call mapdl.exe since that is what it is. To just launch Ansys Mechanical APDL at the command line to be interactive, you would do (Version 2021R1):

"C:\Program Files\ANSYS Inc\v212\ansys\bin\winx64\mapdl"

If you type that into the Command Prompt you get the following MAPDL window popping up (I’ve made the font small so you can see the whole scroll.) You are sitting at the “begin” prompt and can start typing in APDL Commands.

PADT Ansys Starting Command Line upadate f01

As you would expect, there are a ton of command line options that you can use to tell Ansys what to do. Here are what I think are the six most important:

-gTurns on the Ansys Mechanical APDL graphical user interface (GUI)
-b list | nolistRun in batch mode, taking input from standard input or the file specified with -i. “-b list” or “-b” both cause the input file contents to be echoed into the output file. “-b nolist” does not include the input commands in the output file.
-i filename -o filenameSpecify the name of the input and output file in the working directly to read as input or to place output into. These are APDL commands for the input. On linux “<” can be used to take standard input.
-j jobnameBy default, the jobname is “file” and all files created are file.nnn. Specify a unique name as a string for jobname.
-np nThis specifies the number of processors to use during solve.
-dir dirnameSpecifies which directory to solve in. By default, it will be the directory you launch the executable from. But you may want to write files into a different location.

There are 37 total command line options for Ansys Mechanical APDL as of Ansys 2022R2. They control parallel processing, which licenses to call, GPU usage, custom executables of the solver, and a few other things you may want to control. To see the full list and get details on every option, go help in:

“Mechanical APDL | Operations Guide | CHAPTER 4: RUNNING THE MECHANICAL APDL PROGRAM | 4.1. Starting a Mechanical APDL Session from the Command Level”

Ansys Workbench, Including Ansys Mechanical

The Ansys Workbench is fundamentally a program written to use a graphical interface. You can launch it from the command line, have it run commands, and then exit. You can launch a huge array of Ansys products from Ansys Workbench and control them with python commands.

But even in batch mode it is a text-only batch program. Once launched, you can type commands into the command console or use Python scripts to control things. Truthfully, running Ansys Workbench and all the programs it controls is really about scripting and not running from the command line.

To launch Ansys Workbench use:

"c:\program files\ansys inc\v212\framework\bin\win64\runwb2"

The command line options are:

-bRun in batch mode. In batch mode, the user interface is not displayed and a console window is opened. The functionality of the console window is the same as the Ansys Workbench command window.
-r filenameRead the specified script file. If used with -b, the program will exit after the file is read.
-iThis is the default. Run Interactive.
-xUsed with -r. It tells the program to exit after the file specified with -r finishes execution.
-f filename The name of a Workbench project file to load.
-e commandA workbench command to execute after starting. You can specify multiple commands by separating them by a semi-colon or by using multiple -e commands.

Ansys Fluent

Being an older program, and being a CFD tool, Ansys Fluent is much more like Ansys Mechanical APDL when it comes to being run from the command line. You can launch the graphical user interface, GUI, or run in text-only mode.

As an example, this command starts Fluent in 3D solver mode, with graphics off (Version 2021R2):

"c:\program files\ansys inc\v212\fluent\ntbin\win64\fluent" 3d -g

If you run that in the Windows console, you get:

PADT Ansys Starting Command Line upadate f02

The 3D specifies which version to run: 2d, 3d, 2ddp, 3ddp.

There are a ton of options for the Fluent command line because it also supports using schedulers. Here are the five most important ones:

-gTurn of the graphics and launch in text mode
-i filenameRun the journal file commands in filename
> filenameStore text output into filename
< filenameRead Fluent commands from filename
-guStarts fluent in text mode but lets you plot to the screen
-case filenameReads the specified case file after Fluent starts

To see all the other options, and there are a lot, go to Ansys help:

Fluent 2022 R2 | Fluent User’s Guide | PART I: GETTING STARTED | CHAPTER 4: STARTING AND EXECUTING ANSYS FLUENT | 4.1. Starting Ansys Fluent | 4.1.5. Command Line Startup Options

Ansys Electronic Desktop and Ansys HFSS

Ansys HFSS is kind of like Ansys Mechanical APDL in that it has a graphical “workbench” that users use to build, setup, run, and post processes their models: Ansys Electronic Desktop.

The basic command to start Ansys Electronic Desktop is:

ansysedt  <run command(s)> <options> <project file/script file>

The syntax is a little different because it has “run commands” and “options” The options are go with a given run command. This is one where you must read through the full documentation in the Ansys HFSS manual under:
“Getting Started with Ansys Electronics Desktop” > “Ansys Electronic Desktop Overview” > Running Ansys Electronics Desktop form a Command Line”

Here are some examples:

Run a batch distributed Ansys Optimetrics solve on two machines

ansysedt -distributed -machinelist list=”,″ -batchsolve myDesign:Optimetrics “C:\myProject.aedt”

Or run post processing commands without a graphical interface (-BatchExtract) using a python script with commands in it:

ansysedt -ng -batchextract "C:\OptimTee.aedt"

Where the python file, has the following commands in it:

Project = oDesktop.SetActiveProject("OptimTee")
Design = oProject.SetActiveDesign("HFSSDesign1")
Module = oDesign.GetModule("ReportSetup")
Module.UpdateReports(["XY Plot 1"])
Module.ExportToFile("XY Plot 1", "exportToFilePy.csv")

Ansys LS-Dyna

LS-Dyna is a batch solver. Although there are a variety of pre- and post-processors around that work with the solver, most people use Ansys Workbench these days. Workbench will build a command string and then run the solver. If you want to execute your own solves, especially if you modify the input file (filename.k) they provide a handy utility called LS-Run.

image 25
You can use the interface to build your command then press the run bottom (looks like a play button) and it will not only start your run, but manage multiple runs for you across multiple machines. Because of this, unless you are doing something special, you should use the LS-Run program.

But, if you need to run from the command line, you can find the sytax and all the options in the documentation under: “LS-Dyna Keyword User’s Manual, Volume 1” > “Getting Started” > “Execution Syntax”

There are a lot of options, here is the syntax:

LS-DYNA I=inf O=otf G=ptf D3PART=d3part D=dpf F=thf T=tpf A=rrd M=sif S=iff H=iff Z=isf1 L=isf2 B=rlf W=root E=efl X=scl C=cpu K=kill V=vda Y=c3d BEM=bof {KEYWORD} {THERMAL} {COUPLE} {INIT} {CASE} {PGPKEY} MEMORY=nwds MODULE=dll NCPU=ncpu PARA=para ENDTIME=time NCYCLE=ncycle JOBID=jobid D3PROP=d3prop GMINP=gminp GMOUT=gmout MCHECK=y MAP=map MAP1=map1 LAGMAP=lagmap LAGMAP1=lagmap1

Since the input file controls most of the execution, including solver parameters, parallel options, and memory management, you really don’t use most of the options unless you want to override what is in the input file. The most commonly used commands are:

I=infSpecify the LS-Dyna command file. inf is the name of the input file (*.k)
O=otfSpecify the output file. otf is the name of the output file
JOBID=jobidJob name which acts as a prefix for all output files. Maximum
length is 72 characters.
W=rootString to use as the prefix for output files.

The options in curly brackets {} specify solver commands. {THERMAL} runs a thermal only solve, {COUPLE} is thermal and structural. Check the documentation for more options.

A shortcut to figuring this out is to us LS-RUN to build your command for you.

Other Ansys Products

We have only covered the most command Ansys programs out there. There are dozens more and because each started life as as a product written by a different company, they tend to have different command line syntax and options. So, the manual is your friend. Search the help for “command line” or “batch execution” to find the proper documentation.

Original Post: February 29, 2012

image 218

Sometimes you just get tired of clicking on icons.  Sometimes you just need to feel the control and power of launching your applications from the command line.  You type it in, you hit the enter key, and sometimes you can actually hear the disk spin up or the fan run faster to cool the processor as the program you asked for, the program you took time to type out, leaps to life in front of you. Satisfaction.

OK, maybe not.  More often you are scripting some batch solves.  Or maybe you are using the graphical user interface in Workbench but you need to set options for the solvers you are running from within workbench.  Because most of the solvers in the ANSYS family of products predate such new-fangled concepts as GUI’s, and because they are often run remotely on other machines, they have command line interfaces. And that gives the knowledgeable user more power and control.

General Concepts for Launching from the Command Line

Although the number of options available changes from application to applications, there a few common things you should know.


The first and most important concept is to be aware of the path.  This is where most errors happen. One of the big changes over the years is that as software gets more complicated, the executable program or script that you use to launch a solver is now buried deep down inside a directory structure.  Since we never run in that actual directory we need to tell the operating system where the executable is. You can do this by including the full directory path in your command line argument, or by adding it to your path.

On Linux follow the directions in the help:

// Installation and Licensing Documentation // Linux Installation Guide // 5. Post-Installation Instructions

for each of the products you want to run. Generally, you need to set the PATH environmental variable in your .cshrc, .login, or .profile.

On Windows it is not documented, the assumption being that you will be clicking on icons and not typing into a command window.  So a little detective work is needed. Use a file explorer and the Linux documentation on launching to locate the executable for solvers you want to use:

// Installation and Licensing Documentation // Linux Installation Guide // 5. Post-Installation Instructions // 5.3. Launching ANSYS, Inc. Products

The /ansys_inc part is usually replaced with c:\Program Files\ANSYS Inc.  The rest of the path is pretty much the same, swapping forward slashes with backward slashes.  Use these paths in your command line or add to your path by:

  • From the desktop, right-click My Computer and click Properties.
  • In the System Properties window, click on the Advanced tab.
  • In the Advanced section, click the Environment Variables button.
  • Finally, in the Environment Variables window (as shown below), highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.Windows enviromental path settings

    Important note for Windows:  If you are typing the path in on the command line, you need to put it in double quotes.  The convention on Windows is to specify directories with spaces in the name.  But the convention is not to have a command line parser that recognizes this.  So you will get an error if you type:

    C:\Program Files\ANSYS Inc\v140\ansys\bin\winx64\ansys140.exe

    But if you put it in quotes, it works fine:

    “C:\Program Files\ANSYS Inc\v140\ansys\bin\winx64\ansys140.exe”

    Versions Numbering

    If you look at the example for launching MAPDL above you will notice that 140 is used in the directory path and in the name of the executable.  This will change with version:  v130, v145, etc…  Just be aware of that if you are reading this blog posting in 3 years and we are on release 16.5.  you would use:

    “C:\Program Files\ANSYS Inc\v165\ansys\bin\winx64\ansys165.exe”

    Where do you Launch From?

    You of course need a command line to launch a solver.  This is usually a window that lets you type operating system commands: called a Command Prompt in Windows or a shell on Linux.  On Linux it can be an xterm window, a console window, or some other terminal window you have opened.

    But you can also launch from a script, and that script can be launched from a command prompt or shell, or it can be launched by an icon.  All that needs to happen is that the script needs to be executed with the environmental variables required for the command prompt/script or the GUI.  If you don’t know how to make that happen, contact your IT support or someone who understands your operating system and how it runs processes.

    ANSYS Mechanical APDL

    The solver with the most options and capabilities from the command line is Mechanical APDL. So we will start there.  It is important to know these even if you use Mechanical most of the time.  That is because you can set these, and better control your solves, under Tools->Options->Mechanical APDL.  Here is what that dialog looks like:

    image 219

    The most common settings have their own widgets,  and the others can all be accessed by using “- string” command line style arguments in the first text widget aptly named: Command Line Options.

    Here are the options, grouped for your studying pleasure:




    -ansexe Customization In the ANSYS Workbench environment, activates a custom ANSYS executable.
    -custom Customization Calls a custom ANSYS executable. See help on running custom executables for more
    -acc device HPC Enables the use of GPU compute accelerator. As this is written, nvidia is the only option. But as other cards become available look for this to have other options. Check the help.
    -dis HPC Enables Distributed ANSYS. See the Parallel Processing Guide for more information.
    machines HPC Specifies the machines on which to run a Distributed ANSYS analysis. See Starting Distributed ANSYS in the Parallel Processing Guide for more information.
    -mpi HPC Specifies the type of MPI to use. See the Parallel Processing Guide for more information.
    -mpifile HPC Specifies an existing MPI file (appfile) to be used in a Distributed ANSYS run. See Using MPI appfiles in the Parallel Processing Guide for more information.
    -np value HPC Specifies the number of processors to use when running Distributed ANSYS or Shared-memory ANSYS.
    -d device Interface Specifies the type of graphics device. This option applies only to interactive mode. For Linux systems, graphics device choices are X11, X11C, or 3D. For Windows systems, graphics device options are WIN32 or WIN32C, or 3D.
    -g Interface Launches the ANSYS program with the Graphical User Interface (GUI) on. Linux only. On windows do a /SHOW and /MENU,ON to get the GUI up.
    -l language Interface Specifies a language file to use other than US English.
    -b [list | nolist] Launch Activates the ANSYS program in batch mode. The options -b list or -b by itself cause the input listing to be included in the output. The -b nolist option causes the input listing not to be included
    -i inputname Launch Specifies the name of the file to read input into ANSYS for batch processing. On Linux, the preferred method to indicate an input file is <. Requried with -b option.
    -j Jobname Launch Specifies the initial jobname, a name assigned to all files generated by the program for a specific model. If you omit the -j option, the jobname is assumed to be file.
    -o outputname Launch Specifies the name of the file to store the output from a batch execution of ANSYS. On Linux, the preferred method to indicate an output file is >.
    -p productname Launch Defines which ANSYS product will run during the session (ANSYS Multiphysics, ANSYS Structural, etc.). This is how you pull a different licence from the default. Very handing if you have multiple licenses to choose from.
    -s [read | noread] Launch Specifies whether the program reads the start140.ans file at start-up. If you omit the -s option, ANSYS reads the start140.ans file in interactive mode and not in batch mode.
    -dir Luanch Defines the initial working directory. Remember to use double quotes if you have spaces in your directory path name. Using the -dir option overrides the ANSYS140_WORKING_DIRECTORY environment variable.
    -db value Memory Defines the portion of workspace (memory) to be used as the initial allocation for the database. This and -m are the two most important options. If you ever find that ANSYS is writing a *.PAGE file, up this number.
    -m value Memory Idefines the total memory to reserve for the program. It is always better to reserve it up front rather than letting ANSYS grab as it needs.
    -schost host name MFX Specifies the host machine on which the coupling service is running (to which the co-simulation participant/solver must connect) in a System Coupling analysis.
    -scname name of the solver MFX Specifies the unique name used by the co-simulation participant to identify itself to the coupling service in a System Coupling analysis. For Linux systems, you need to escape the quotes or escape the space to have the name recognized with a space:
    -scport port number MFX Specifies the port on the host machine upon which the coupling service is listening for connections from co-simulation participants in a System Coupling analysis.
    -mfm MFX Specifies the master field name in an ANSYS Multi-field solver – MFX analysis. See Starting and Stopping an MFX Analysis in the Coupled-Field Analysis Guide for more information.
    -ser value MFX Specifies the communication port number between ANSYS and CFX in an MFX analysis.
    -dvt Other Enables ANSYS DesignXplorer advanced task (add-on).
    -dyn Other Enables LS-DYNA.
    -v Other Returns the ANSYS release number, update number, copyright date, customer number, and license manager version number. Does not actually run ANSYS MAPDL.
    name value Params Defines ANSYS parameters at program start-up. The parameter name must be at least two characters long. These get passed into ANSYS and are used by any APDL scripts you run.

    The ones that everyone should know about are: –p, –m, –db.  We find that not using these to define what license to use (-p) or to control how memory is pre-allocated (-m, –db) generate the most tech support questions.    The next most important is the –np command. Use this to define more processors if you have HPC licenses.

    Cheating – Use the Launcher

    Sometimes the options can get long and confusing.  So what I do is I use the “ANSYS Mechanical APDL Launcher” and fill in all the forms. then go to tools->View Display Command Line and I can see all the options.

    image 220

    Here is a a fancy command line that got generated that way:

    “C:\Program Files\ANSYS Inc\v140\ANSYS\bin\winx64\ansys140.exe”  -g -p ane3flds -np 2 -acc nvidia -dir “c:\temp” -j “grgewrt1” -s read -m 5000 -db 1000 -l en-us -lstp1 32 -t -d win32 -custom “/temp/myansys.exe”

    It runs interactive (-g), uses a multiphysics license (-p ane3flds), grabs two processors (-np 2), uses an NVIDEA GPU (-acc nvidia (I don’t have one…)), runs in my temp directory (-dir), uses a job name of grgewrt1 (-j), reads the start.ans file (-s), grabs 5000mb and 1000mb for memory (-m, –db), uses English, passes in a parameter called lstp1 and sets it to 32 (-), uses the win32 graphics driver (-d) and runs my custom ANSYS executable (-custom).

    I have no idea what –t is.  Some undocumented option I guess…

    ANSYS Workbench

ANSYS Workbench also has some command line arguments. not as rich as what is available in MAPDL, but still powerful. It allows you to run Mechanical in Batch or Interactive mode, supply python commands as needed.  The key thing to remember is that the workbench interface is not Mechanical or FLUENT. It is the infrastructure that other programs run on. Scripting in workbench allows you to control material properties, parameters, and how systems are created and executed.

Here are the options:

Argument Operation
-BRun ANSYS Workbench in batch mode. In this mode, the user interface is not displayed and a console window is opened. The functionality of the console window is the same as the ANSYS Workbench Command Window.
-R <ANSYS Workbench script file>Replay the specified ANSYS Workbench script file on start-up. If specified in conjunction with –B, ANSYS Workbench will start in batch mode, execute the specified script, and shut down at the completion of script execution.
-IRun ANSYS Workbench in interactive mode. This is typically the default, but if specified in conjunction with –B, both the user interface and console window are opened.
-XRun ANSYS Workbench interactively and then exit upon completion of script execution. Typically used in conjunction with –R.
-F <ANSYS Workbench project file>Load the specified ANSYS Workbench project file on start-up.
-E <command>Execute the specified ANSYS Workbench scripting command on start-up. You can issue multiple commands, separated with a semicolon (;), or specify this argument multiple times and the commands will be executed in order.

The big deal in this list is the –B argument.  This allows you to run workbench, and applications controlled by the project page, in batch mode.  You will usually use the –R argument to specify the Iron Python script you want to run.  In most cases you will often want to throw in a –X to make sure it exists when the script is done.

Other ANSYS Products

Here is where it gets boring.  The other products just don’t have all those options. At least not documented.  So you simply find the executable and run it.  Here is the list for Linux. Use it to find the location on Windows.



Mechanical APDL/ansys_inc/v140/ansys/bin/ansys140
ANSYS Workbench/ansys_inc/v140/Framework/bin/<platform>/runwb2
ANSYS CFX/ansys_inc/v140/CFX/bin/cfx5
ANSYS FLUENT/ansys_inc/v140/fluent/bin/fluent
ANSYS ICEM CFD/ansys_inc/v140/icemcfd/<platform>/bin/icemcfd
ANSYS POLYFLOW/ansys_inc/v140/polyflow/bin/polyman
ANSYS CFD-Post  /ansys_inc/v140/CFD-Post/bin/cfdpost
ANSYS Icepak/ansys_inc/v140/Icepak/bin/icepak
ANSYS TurboGrid  /ansys_inc/v140/TurboGrid/bin/cfxtg
ANSYS AUTODYN/ansys_inc/v140/autodyn/bin/autodyn140

Get Your Ansys Products & Support from the Engineers who Contribute to this Blog.

Technical Expertise to Enable your Additive Manufacturing Success.

PADT’s Pulse Newsletter

Keep up to date on what is going on at PADT by subscribing to our newsletter.

By submitting this form, you are consenting to receive marketing emails from: . You can revoke your consent to receive emails at any time by using the SafeUnsubscribe® link, found at the bottom of every email. Emails are serviced by Constant Contact

Share this post:

Upcoming Events


Connect Updates in Ansys 2024 R1 - Webinar


Structures Updates in Ansys 2024 R1 (3) - Webinar


E-Mobility and Clean Energy Summit


Fluids Updates in Ansys 2024 R1 - Webinar


Stratafest - Denver, CO


2024 CEO Leadership Retreat


New Mexico Tech Summit 2024


PADT30 | Nerdtoberfest 2024

Search in PADT site

Contact Us

Most of our customers receive their support over the phone or via email. Customers who are close by can also set up a face-to-face appointment with one of our engineers.

For most locations, simply contact us: