Script for batch converting 3DM to DXF or exporting to DXF from layers?

In Rhino _Options menu, advanced, there is the following path Rhino.Options.DefaultFileDialogDirectories.ExportDirectory
and I tought that this path is updated every time you export selected curves but only updates every time you open a Rhino file.

My goal is use the script to export a DXF file (solved) but compare the path from my rs.DocumentPath() and the path of the last exported in order to avoid mistakes saving the DXF files in a wrong path.

If last exported path (subpath) = rs.DocumentPath() then open last exported path, else open document path

This optimizes when you want to save multiple DXF curves with different names and do not want to select every time the subfolder. Same process when you use export selected curves from rhino option.

Solved how to access to Rhino.Options.DefaultFileDialogDirectories.ExportDirectory

Another option is after exporting a DXF file to save a txt in a specific path storing the string of the path, and every time I use the script compare the string included inside the txt file, but I think that this could be solved an easier way…