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 this (except for your replacements for file and folder names):

for %%f in (*.dwg) do (
"C:\Program Files\AutoCAD Map 3D 2010\acad.exe" %%f /b MyExport.scr
rename SDFs\Temp.sdf %%~nf.sdf
)
NoteThis exercise continues the process of batch-exporting from the previous exercise, Exercise 2: Create 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 2010\acad.exe" %%f /b MyExport.scr

    If your version of AutoCAD Map 3D is installed in a different folder, substitute that location for C:\Program Files\AutoCAD Map 3D 2010\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 Exercise 4: Run the Batch File.