The following example shows how to amend the batch file you created in Creating a Simple Batch File. In this example, you specify the location of the DWG files and the location of the exported files. The batch file creates a script for each DWG file. It uses a profile with the same name as the DWG file.
For example, Dubuque.dwg would have to have a corresponding Dubuque.epf. So, to use this method, create an EPF for each DWG.
To create the complex batch file
set srcDir=D:\Redding\DWGs set outDir=D:\ReddingSDFs
Substitute the directories shown with your own directories. Specify the directories where you store the drawing files and the exported files.
for %%f in (%srcDir%\*.dwg) do ( echo _-mapexport> temp.scr echo FDO_SDF>> temp.scr echo %outDir%\%%~nf.sdf>> temp.scr echo _yes>> temp.scr
echo %%~df%%~pf%%~nf.epf>> temp.scr
echo _proceed>> temp.scr
echo _quit>> temp.scr
"C:\Program Files\AutoCAD Map 3D 2021\acad.exe" %%f /b temp.scr
)
Substitute the location of your installed application, if needed.
Run the batch file from the Command window. You can also use the DOS "AT" command to set up a schedule to run the batch file automatically at specific times.
You refined the batch file you created in Creating a Simple Batch File. The file now specifies the location of the DWG files and the location of the exported files.
To continue this tutorial, go to Creating a Production Batch File.