AutoCAD Command Line Switches
What are Command Line Switches Kenny?
Command Line Switches are parameters that you add to the acad.exe command line which enable AutoCAD to perform additional operations when it starts. For example, AutoCAD can start with an alternative configuration, run a script, load a template drawing and even open a drawing with a saved view.
Personally, I feel that Command Line Switches are often neglected by the AutoCAD programmer/system manager. Why? I don't know as they can drastically cut down on setting up workstations and help a hell of a lot in enforcing drawing office standards.
Before we have a look at the Command Line Switches, let's have a look at how AutoCAD deals with them:
- If you use a Command Line Switch to specify an environment setting, the Command Line Switch overrides the settings specified in either the Options dialog box or the environment value.
- If a Command Line Switch is not set, the corresponding value set in the Options dialog box is used.
- If neither a Command Line Switch nor an Options value is set, the environment variable value is used.
Note: Command Line Switches and environment variable override option values are for the current session only. They do not alter the system registry.
Okay dokey, now let's have a look at how we go about changing a Command Line Switch:
- Make a backup copy of your AutoCAD icon. Right-click on the icon and then Copy and Paste it to a safe location.
- Again, Right-Click on the AutoCAD icon on your Desktop.
- Choose "Properties"
- In the Properties dialog, select the "Shortcut" tab.
This is what it should look like:
The section that we are interested in is the "Target" edit box, which in this example contains a long string but includes the text "acad.exe"
Note: If the Target edit box on your shortcut properties dialog is greyed out, like the one below, you will need to create your own custom shortcut before proceeding. To do this, right-click on the desktop and select "New" and "Shortcut". In the Create Shortcut dialog, click the "Browse…" button and select your acad.exe file. You'll most likely find it at C:/Program Files/Autodesk/Autocad version/acad.exe.
A word of warning though, when making changes to the Target box, make sure you don't accidentally remove any section of the application path or filename itself, Make sure that there is a single space after the path and file argument and before you switch. Also, ensure there is a space between each argument and your switch statements. If your path or file names have spaces in them, you will have to surround the path or name with double quotes. In fact, to be on the safe side, I surround all my paths and file names with double quotes.
Right, let's have a look at some of the most useful switches:
|Switch, Syntax and Example||Description|
path ["drawing file"] /b "script"
|Opens a drawing and runs a script. Drawing name is optional.|
|"C:\Program Files\Autodesk\AutoCAD version\acad.exe" /b "C:\scripts\MyScript"|
path /c "Configuration File"
|Specifies the hardware configuration file to use.|
|"C:\Program Files\Autodesk\AutoCAD version\acad.exe" /c "C:\configs\MyConfig"|
|Starts AutoCAD without the splash screen.|
|"C:\Program Files\Autodesk\AutoCAD version\acad.exe" /nologo|
path /p "Profile Name"
|Starts AutoCAD with a specified profile. If the profile doesn't exist, AutoCAD uses the current profile.|
|"C:\Program Files\Autodesk\AutoCAD version\acad.exe" /p "MyProfile"|
|Resets all AutoCAD default settings, printers and system pointing device.|
|"C:\Program Files\Autodesk\AutoCAD version\acad.exe" /r|
path /s "Support Paths"
|Designates additional support paths, each separated with a semicolon.|
|"C:\Program Files\Autodesk\AutoCAD version\acad.exe" /s "C:\Blocks;C:\Lisp;C:\VBA"|
path ["drawing file"] /t "Template File"
|Creates a new drawing based on a template or prototype drawing.|
|"C:\Program Files\Autodesk\AutoCAD version\acad.exe" /t "C:\templates\MyTemplate"|
path ["drawing file"] /v "View"
|Opens a drawing with a predefined view.|
|"C:\Program Files\Autodesk\AutoCAD version\acad.exe" "MyDrawing" /v "MyView"|
path ["drawing file"] /v "Workspace"
|Starts AutoCAD with a workspace of your choice. If the workspace does not exist, the default is loaded.|
|"C:\Program Files\Autodesk\AutoCAD version\acad.exe" /w "MyWorkspace"|
See the Autodesk Customize Startup document for a complete list of command line switches.
You can of course string the Command Line Switches together. For example, to open AutoCAD with no splash screen using a user defined profile and template drawing, you would use the following syntax:
C:\Program Files\Autodesk\AutoCAD version\acad.exe" /nologo /p "MyProfile" /t "C:\templates\MyTemplate"
Would you like AutoCAD to open in a specific directory every time?
You would? Good!!!
Then just place your directory path in the "Start In" edit box.