AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

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 variables override Options values 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 2002 icon. Right-click on the icon and then Copy and Paste it to a safe location.
  • Again, Right-Click on the AutoCAD 2002 icon on your Desktop.
  • Choose Properties
  • In the AutoCAD 2002 Properties dialog, select the Shortcut tab.

This is what it should look like :

The AutoCAD 2002 Properties Dialog

The section that we are interested in is the "Target" edit box, which in this example contains "C:\AutoCAD 2002\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 the switches :

Switch Syntax and Example Description
/b
path ["drawing file"] /b "script"

"C:\AutoCAD 2002\acad.exe" /b "C:\scripts\MyScript"
Open a drawing and runs a Script. Drawing name is optional.
/c
path /c "Configuration File"

"C:\AutoCAD 2002\acad.exe" /c "C:\myconfigs\MyConfig"
Specifies the hardware configuration file to use.
/nologo
path  /nologo

"C:\AutoCAD 2002\acad.exe" /nologo
Starts AutoCAD without the splash screen.
/p
path  /b profile

"C:\AutoCAD 2002\acad.exe" /p "C:\profiles\MyProfile"
Starts AutoCAD with the specified Profile name. If the Profile does not exist, AutoCAD uses the current Profile.
/r
path /r

"C:\AutoCAD 2002\acad.exe" /r
Resets all AutoCAD default settings, printers and system pointing device.
/s
path /s "Support Paths"

"C:\AutoCAD 2002\acad.exe" /s "C:\Blocks;C:\Lisp;C:\VBA"
Designates additional Support Paths.
/t
path  ["drawing file"] /t "Template File"
"C:\AutoCAD 2002\acad.exe" /t "C:\MyTemplates\MyTemplate"
Creates a new drawing based on a Template or Prototype drawing. Drawing name is optional.
/v
path  ["drawing file"] /v "View Name"
"C:\AutoCAD 2002\acad.exe" "MyDrawing" /v "MyView"
Opens a drawing with a predefined view.

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:\AutoCAD 2002\acad.exe" /nologo /p "C:\profiles\MyProfile" /t "C:\MyTemplates\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. Easy hey?

 
The AutoLisp/Visual Lisp/VBA Resource Website

Copyright © 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website