AutoCAD Scripts (.scr): How to Write, Run and Batch Them
Updated October 2026 | 74mph Solutions
It is 4:30 on a Friday. The client wants the new title block on all 200 sheets by Monday. You open the first drawing, make the change, save, close. One down, 199 to go.
An AutoCAD script does that change for you. It is a plain text file of the exact commands and answers you would type, and AutoCAD plays it back in order, at full speed, without a single click. This guide shows you how to write one, how to run it, the 4 rules that make scripts fail, and how to run one script on every drawing in a folder.
What Is an AutoCAD Script?
A script is a text file with the extension .scr. Each line is something you would type at the AutoCAD Command prompt: a command name, or the answer to the prompt that command asks next. You can write one in Notepad.
AutoCAD and AutoCAD LT both run scripts. Scripts can also call AutoLISP, but LISP inside a script needs full AutoCAD or AutoCAD LT 2024 and later.
Your First Script in 4 Lines
Open Notepad, type these lines, and save the file as cleanup.scr:
;Zoom to the whole drawing and save it
ZOOM
E
QSAVE
Line by line: the first line is a comment. ZOOM starts the command. E answers its prompt with Extents. QSAVE saves the drawing.
How to Run a Script in AutoCAD
- Open the drawing.
- Type
SCRIPTat the Command prompt and press Enter (or use Manage tab > Applications > Run Script). - Pick your
.scrfile. AutoCAD runs every line, top to bottom.
That runs the script on the drawing that is open. To run it on many drawings, see running one script on many drawings below.
The 4 Rules That Break AutoCAD Scripts
Most script failures come down to these four. When a script "gets out of step", one of them is almost always the reason.
- A blank line or a space is an Enter. A blank line repeats the last command. An invisible space at the end of a line sends an extra Enter. Use a blank line only where you mean Enter.
- Comments go on their own line. Start the line with a semicolon. A comment after a command on the same line is read as input. See the comment rules.
- Dialog boxes stop scripts. Use the command line version of a command, the one with a hyphen:
-LAYER,-PURGE,-INSERT,-XREF,-PLOT. SetFILEDIAto 0 so commands that ask for a file ask at the command line. See the AutoCAD commands list and the system variables list. - End the last line with a line break. If the file stops right after the last command, that command may not run.
Skip the Rules: Record Your Script Instead
You do not have to write the script by hand. Hurricane's Command Capture records the commands while you make the change once, by hand, in AutoCAD, and turns them into a script: every command and every answer, in the right order. Hurricane then replays that script as a Hurricane batch script, on every drawing in the batch.
Hurricane also ships with ready-made sample scripts and wizards for common jobs such as title blocks, text search and replace, and page setups.
AutoCAD Script Examples
Purge everything unused
;Purge all unused items, no prompts, twice to catch nested items
-PURGE
A
*
N
-PURGE
A
*
N
QSAVE
Make a layer current and freeze another
;Make layer 0 current, freeze layer A-NOTES
;The blank line before QSAVE ends the -LAYER command
-LAYER
S
0
F
A-NOTES
QSAVE
Plot to PDF
Plot scripts are longer because -PLOT asks about 17 questions. The full script, line by line, is in How to Batch Plot AutoCAD Drawings.
For selecting objects inside a script (ALL, Window, Crossing, by layer), see How to Select Objects in an AutoCAD Script. For layer filters and states, see Script Layer Operations in Batch. For which commands work at the command line, see AutoCAD Batch Scripts: Which Commands Work at the Command Line? For a printable one-page summary, see the AutoCAD Batch Scripting Cheat Sheet.
Running One Script on Many Drawings
The SCRIPT command runs on the drawing that is open. A real job has a folder of drawings, and the script has to open each one, run, save, close, and move to the next. You have three options:
- Write the loop yourself. A master script that opens each drawing by name. It works for a few files, but every new folder means a new script, and one wrong path stops the run.
- ScriptPro. Autodesk's free batch utility. See when Hurricane fits better than ScriptPro.
- Hurricane. You pick the folder (subfolders too) and the script, then click Create and Run. Hurricane writes the open, run, save, close loop for every drawing and runs it in AutoCAD. Start it now and walk away, or schedule it overnight with Night Run. It is a stand-alone Windows program, not a plug-in, and works with AutoCAD, AutoCAD LT, BricsCAD, IntelliCAD and DraftSight.
Your script, on every drawing in the folder.
Record it once with Command Capture, then let Hurricane run it on the whole set.
Free trial, no time limit, no credit card.
AutoCAD Script FAQ
Does AutoCAD LT run scripts?
Yes. AutoCAD LT runs .scr scripts with the SCRIPT command. AutoLISP inside a script needs AutoCAD LT 2024 or later, or full AutoCAD.
What program do I use to write an AutoCAD script?
Any plain text editor, such as Notepad. Save the file with the .scr extension. Do not use Word, which adds hidden formatting.
Why does my AutoCAD script stop halfway?
Usually a dialog box opened (use the hyphen version of the command), or a blank line or stray space sent an extra Enter and the answers fell out of step. Run the script on one drawing and watch the command line to see where it goes wrong.
Can an AutoCAD script run on many drawings at once?
A script runs in one drawing. To run it on a folder, something has to open each drawing in turn, run the script, save and close. Hurricane does that for every drawing in the folder.
Monday morning: 200 sheets updated, and you did the change once.
Try Hurricane free.
No time limit, no credit card. Works with AutoCAD 2026 and all prior versions, AutoCAD LT, BricsCAD, IntelliCAD and DraftSight.
Related: Batch Scripting Cheat Sheet | AutoCAD Commands List | System Variables List | Batch Plot AutoCAD Drawings