Start Maya from the command line

If you start Maya from the command line, there are various startup options you can specify. For example, you can open a file at startup using the -file flag:

maya -file filename
maya.exe -file filename

To see the available startup flags, type the following:

maya -help

Running Maya in batch or prompt mode

Maya can be run in several distinct modes that affect its overall manner of operation, two of which allow you to execute Maya commands without the interface, -prompt and -batch (on Windows, use mayabatch.exe instead of maya -batch).

Note:
  • The -batch command is not used for batch rendering. Instead, use the Render command.
  • On Windows, type mayabatch when using the -batch flag. The mayabatch command runs within the command prompt window, whereas the maya command starts a separate window.
  • The -render flag is now obsolete. Use the Render -r command instead.

Additional Maya startup flags

These are additional flags you can use when starting up Maya from the command line (maya on Linux/Mac OS X; mayabatch.exe on Windows).

-archive [file]

Displays a list of files required to archive the specified scene and then exits Maya.

-command [mel command]

Runs the specified command on startup. The command should be enclosed in double quotes to protect any special characters, including spaces.

-log [file]

Copies all standard output and error messages (those that normally appear in the Output Window) to the specified file (use complete file name).

This flag is for Windows only.

-noAutoloadPlugins

Do not auto-load any plug-ins.

-optimizeRender [file] [outfile]

Processes the specified scene file to optimize it for rendering, puts the result in outfile and then exits. Use maya -optimizeRender -help for more options. See -optimizeRender flags.

-proj [dir]

Looks for scene files in the specified project directory.

-recover

Recovers the last journal file.

-script [file]

Sources the specified file (which is expected to be a MEL script) on startup.

-v

Displays the product version and cut number, and then exits.

-3

Enable Python 3000 compatibility warnings.
Note:

Beginning Maya 2012, for the Linux and Mac platforms, there are checks to ensure that the directory pointed to by lastLocalWS is accessible before Maya attempts to use it. The directory must have 555 (r-xr-xr-x) permissions. Otherwise, if the directory only has 444(r--r--r--) permissions, Maya cannot use it; even cd or ls do not work.

In addition to lastLocalWS, there are other workspaces that Maya tries to use on startup, and the same check is being applied to these workspaces also. The order in which Maya tries to use these workspaces are as follows:

  • the value obtained from the -proj command line argument
  • the value obtained from the MAYA_PROJECT environment variable
  • the InitialProject optionVar (i.e. the preference labeled Always start in this project)
  • the lastLocalWS optionVar (stored automatically by Maya at exit to remember the last active workspace
  • the default project

-optimizeRender flags

Use this command to optimize the specified scene file for rendering, send the result to an output file and then close Maya.

maya -optimizeRender [options] [file] [outfile]

The available [options] are:

-botRes [int]

Specify a minimum file texture resolution that will cause BOT files to be produced. For example, specifying “-botRes 256” means that all file textures bigger than 256x256.will be converted to BOT format.

-botLoca [name]

Specify the directory in which BOT files reside. The default is in the same directory as the original file.

-help

Displays all the flags available for use with -optimizeRender.

-noBOT

Does not create BOT files.

-noCleanup

Does not clean up useless data.

-tessFreeze [startframe] [endframe] [byframe]

Calculates NURBS tessellation that gives the best image quality based on the camera projection.