Exercise 3: Create the Batch File

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 2025\acad.exe" %%f /b MyExport.scr
rename SDFs\Temp.sdf %%~nf.sdf
)
Note:

This exercise continues the process of batch-exporting from the previous exercise, Creating the Script File.

To create the batch file

  1. Start the Notepad application from your computer desktop. For example, click Start Accessories Notepad.
  2. 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.

  3. Press Enter and enter the following:

    "C:\Program Files\AutoCAD Map 3D 2025\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 2025\acad.exe. Substitute the name of your script file for MyExport.scr.

  4. 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.

  5. Press Enter and close the expression by typing a close parenthesis.
  6. 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.