Type one line of AutoCAD commands, point at a folder, and BATCHSCRIPT writes a script that repeats that line for every drawing it finds — then runs it. No drawing is opened by hand and no script file has to be written.
What BatchScript does
The line uses the token *file* wherever a drawing name belongs. So this:
_.open *file* _.saveas *file* _.close
becomes, for a folder of two hundred drawings, two hundred lines that open each one, save it in the current format and close it. That single example is the standard fix for a whole project stuck in an old DWG version.
Anything you can type at the command line can go in that line: purge a whole set, audit it, insert a revised title block, or run one of your own LISP commands across every sheet.
Saved lines are remembered. Every line you save is offered again from the Load button, so the operations you run regularly are one click away. The list, the last folder used and the sub-folder setting are written to a small configuration file and reloaded next time.
How to use it
- Copy the folder first. See the warning below — this is not optional advice.
- Load the routine with
APPLOAD, or put it on your support file search path. - Type
BATCHSCRIPT. - Type the command line, using
*file*where a drawing name belongs. Or press Load to recall one you saved earlier. - Choose the folder, and tick sub-folders if you want it to recurse.
- Accept the dialog. The script starts immediately.
How it works
The script line is split on the *file* token into fixed fragments. For every drawing found, those fragments are re-joined with the drawing’s full path substituted at each token position — in quotes, so spaces in folder names cannot break the script. The assembled lines are written to a script file and handed to the SCRIPT command.
AutoCAD executes a script line by line exactly as if it had been typed, which is why an ordinary command sequence works unaltered. There is no special syntax to learn beyond the token.
Folder scanning is recursive when the sub-folders box is ticked: each folder’s sub-folders are found and searched in turn, all the way down.
Load can also read an existing .scr file. Its first line is read and the drawing name in it turned back into a *file* token, which recovers an editable script line from a script somebody else wrote — useful when you have inherited a script and want to understand or adapt it.
Notes and limits
- A batch script modifies drawings without opening them in front of you, and there is no undo across files. A line with a mistake in it will apply that mistake to every drawing in the folder. Test on a copy of the folder first. Every time.
- The script starts as soon as the dialog is accepted. There is no second confirmation.
- The current drawing is not part of the run. AutoCAD executes the script in whatever drawing you are in, so the first thing your line should normally do is open a file.
- Check the line on one drawing before turning it loose. Point it at a folder containing a single test file first.
Download and details
| Name | BatchScript — run the same operation on every drawing in a folder |
| Download | BatchScript.lsp — 30.8 KB, plain AutoLISP source. Downloads directly; no zip to unpack. |
| Type | AutoCAD AutoLISP routine |
| Command | BATCHSCRIPT |
| Requires | the ActiveX layer (loaded automatically by the routine with vl-load-com); nothing extra — the dialog is written to a temporary file at run time and deleted again, so there is no .dcl to install. |
| Source size | 30.8 KB, 740 lines |
| Error handling | Yes — a *error* handler restores every system variable it changed, on cancel as well as on error. |
| Undo | The whole operation is wrapped in a single undo group, so one U reverses all of it. |
| Compatibility | AutoCAD (any release with AutoLISP), BricsCAD, ZWCAD, GstarCAD, ProgeCAD and other IntelliCAD-based platforms. AutoCAD LT needs a LISP enabler. No .NET, no ObjectARX, no installer. |
| Author | YZ, August 2026 |
| Licence | Free to use, supplied “as is” with no warranty. |
References
- ATTPULL and ATTPUSH LISP — batch attribute extract and edit, without scripting
- DWGPUSH LISP — another way to push changes across a folder
- More free AutoLISP routines on this site
- Wisey’s Steel Shapes — free structural steel section drawing program