View Categories

setvar doesn’t work in accoreconsole

1 min read

Problem #

Sometimes you may find that specifying (setvar "filedia" 1) in an .scr script simply doesn’t reset filedia to 1.

Here’s the simplest .scr script that reproduces the issue:


(command "NETLOAD" "%YourDLL%")
%YourCommandMethod%
(setvar "filedia" 1)

Or just

(setvar "filedia" 1)

The outcome is the same; the program behaves as if filedia=0. In other words, the AutoCAD dialog is simply not shown when running in AutoCAD GUI.

Setting filedia to 1 is absolutely essential when running an .scr script via AutoCAD Console (accoreconsole.exe). accoreconsole, which is the GUI-less AutoCAD/Civil 3D engine, automatically resets filedia to 0 at the beginning of execution—and leaves it that way.


Why is filedia so important? #

filedia is the AutoCAD system variable that controls whether file-related dialog boxes appear (0 disables them). This is a common source of confusion for many new AutoCAD users because someone may have changed the variable, and the next operator will assume AutoCAD is “broken” when dialog boxes stop appearing.


Solution 1: Change the registry manually #

The registry entry for filedia is located at:

HKCU\Software\Autodesk\AutoCAD\R25.1\ACAD-9100:409\FixedProfile\General Configuration\FileDialog

(Civil 3D 2026)

Changing the value to 1 restores dialog boxes.


Solution 2: Explicitly call QUIT #

For some reason, you must explicitly issue the QUIT command at the end of the .scr script for the setvar change to persist. The script below works:


(command "NETLOAD" "%YourDLL%")
%YourCommandMethod%
(setvar "filedia" 1)
QUIT

It appears that executing QUIT forces AutoCAD to save the system variable.

Powered by BetterDocs