The batch file contains commands that run the script and apply the export profile. Create the batch file in a text editor, such as Notepad.
The finished batch file looks like the following example (except for your replacements for file and folder names):
for %%f in (*.dwg) do (
"C:\Program Files\AutoCAD Map 3D 2026\acad.exe" %%f /b MyExport.scr
rename SDFs\Temp.sdf %%~nf.sdf
)
This exercise continues the process of batch-exporting from the previous exercise, Creating the Script File.
To create the batch file
- Start the Notepad application from your computer desktop. For example, click Start
Accessories
Notepad.
- Enter the following:
for %%f in (*.dwg) do (
The variable %%f tells the batch file to iterate through the folder, selecting a new file each time. The expression (*.dwg) tells the batch file to look for files with the extension .dwg.
- Press Enter and enter the following:
"C:\Program Files\AutoCAD Map 3D 2026\acad.exe" %%f /b MyExport.scr
If your version of AutoCAD Map 3D toolset is installed in a different folder, substitute that location for C:\Program Files\AutoCAD Map 3D 2026\acad.exe. Substitute the name of your script file for MyExport.scr.
- Press Enter and enter the following:
rename SDFs\Temp.sdf %%~nf.sdf
Replace SDFs\Temp.sdf with the location you specified in the script file.
- Press Enter and close the expression by typing a close parenthesis.
- Save and close the batch file.
Save the batch file in the same folder as the DWG files to export.
To continue this tutorial, go to Running the Batch File.