Batch Print Maps

Using ArcMap 9.x.

@echo off
:: print-all-maps.bat
echo. 
echo. Printing all maps in current directory to default printer 
echo. 
echo  Press [ctrl-break] to abort. 
echo. 
for %%a in (*.mxd) do ( 
  echo.  Processing %%a 
  start /wait C:\path\to\ArcGIS\Bin\ArcMap.exe /p "%%a" 
  ) 

It is a bit quirky and doesn’t always work. The most annoying things are a) it ignores the .mxd page size setting and always uses the printers’ default page, and b) Addons like MapBook need to be uninstalled or else there will be an error dialog after each .mxd (the map still prints though). For the latter case please see the improved uninstall at http://code.google.com/p/arcmapbook/ which allows one to quickly (un)install as needed.

There is another commandline parameter, /ptprintto “, but I haven’t found any documentation for it so don’t know how to use it. In conversation with ESRI Canada tech support, this is what we know so far:

C:\PROGRA~1\ArcGIS\Bin\ArcMap.exe /pt "%1" "%2" "%3" "%4"
%1 is path to MXD
%2 is printer
%3 is ?
%4 is ?

Well it turns out that your request generated two new NIM’s.

#NIM043093 Command line invocation of ArcMap using the “printto” option does not print to a named printer.

#NIM043092 MXD and MXT file types in Windows folder options have three actions (open, print, printto) that should be available from a command line but are not documented.

In our testing, parameter 1 is the map document, parameter 2 is the printer name, but we could not find any information on parameters 3 and 4. It’s possible these parameters could be leftover configuration settings from ArcInfo Workstation. Specifying a printer by using the “/pt” option with a valid printer name did not cause the output to be directed to the named printer; it always goes to the default printer. If an invalid printer is specified, printing fails, so the printer name is being read successfully but ignored.

You can view these NIM online, when their status changes to resolve you are more than welcome to contact me if the documentation is not found.

Update 2009-Dec

/printto finally fixed in 9.4! (you must be logged in to support.esri.com to see the report, which doesn’t say much more than I just did).

In 9.3 the syntax has changed to:

"C:\Path\To\Common Files\ArcGIS\bin\ArcGISFileHandler.exe" /p "Foobar Map.mxd"

Leave a Reply

Your email address will not be published. Required fields are marked *