Exercise 1: Extend the Batch File Capabilities
 
 
 

The following example shows how to amend the batch file you created in Lesson 1: Create 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 new 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, you must create an EPF for each DWG.

To create the complex batch file

  1. In Notepad, enter the following:
    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.

  2. Create the temporary export script temp.scr by entering the following lines.
    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
  3. Create an export profile with the same base name as the drawing file.
    echo %%~df%%~pf%%~nf.epf>> temp.scr
    echo _proceed>> temp.scr
    echo _quit>> temp.scr
    "C:\Program Files\AutoCAD Map 3D 2010\acad.exe" %%f /b temp.scr
    )

    Substitute the location of your installed application, if needed.

  4. Name and save the batch file.
    NoteYou will run the batch file from the Command window. You can also use the DOS "AT" command to set up a schedule that will automatically run the batch file at specific times.

Where you are now

You refined the batch file you created in Lesson 1: Create a Simple Batch File to specify the location of the DWG files and the location of the exported files.

To continue this tutorial, go to Exercise 2: Create a Production Batch File.