Search code examples
vbabatch-fileautocadautolisp

Start Autocad and run VBA automatically with .bat files


I have the following problem. I have an app that retrieves dwg files from a specific network location. Once retrieved i have written some vba commands that retrieve those files and do some operations on them.

I want to be able to automate this whole procedure with a .bat file.

Start .net -> finish .net -> start Autocad.

And again for the second program.

For one app this works great. I have used this VBA run on startup. But this limits me to one since the programs will start at different times and start the same instance of vba. These two programs will run on the same computer and will run as services.

The simpler way that i found to start autocad with .net is through a bat file. Is there some way to automate some commands with the bat file or whatever.

For example the 2 script might look sth like this inside a bat file.

"C:\Program Files\Autodesk\AutoCAD 20XX\acad.exe" with firstListOfCommands.scr

"C:\Program Files\Autodesk\AutoCAD 20XX\acad.exe" with secondListOfCommands.scr

Do you have any suggestions on how can i achieve this?


Solution

  • The command line switch to specify a script for AutoCAD to run on opening is /b.

    "C:\Program Files\Autodesk\AutoCAD 20XX\acad.exe /b firstListOfCommands.scr”

    Reference: http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-8E54B6EC-5B52-4F62-B7FC-0D4E1EDF093A