Running AutoSplit from a Command-Line BAT File
Introduction
It is possible to run AutoSplit Professional operations from outside of Adobe Acrobat via a command-line BAT file. Use this method to automate document processing by starting the processing from an another application or Windows Task Scheduler. This functionality is available in version 5.6 and up.
You would need to configure the particular AutoSplit operation using a regular method via user interface prior to running it via a BAT file.
Configure AutoSplit Operation
IMPORTANT: Make sure you are using AutoSplit Pro plug-in. This functionality is not available in AutoSplit Standard.
Use plug-in's menu(s) to configure a particular AutoSplit operation. Here is the list of the operations that are supported for the BAT file execution:
  1. Split Document
  2. Auto-Rename PDF Files
  3. Merge Multiple Documents Using Control File
  4. Merge Documents into Single Document
  5. Merge Documents from Multiple Folders
  6. Merge Documents with Similar Filenames
Save the Processing Settings
Each of the above mentioned operations provides a way to save processing parameters as a settings file. For example, for "Split Document" use "Save Profile" button to save settings as *.apr file. All other operations have a set of "Save Settings" and "Load Settings" buttons for saving settings into a file.
Here is a list of settings file extensions for each operation:
  1. Split Document: *.apr
  2. Auto-Rename PDF Files: *.docren
  3. Merge Multiple Documents Using Control File: *.mergefile
  4. Merge Documents into Single Document: *.ams
  5. Merge Documents from Multiple Folders: *.mfmf
  6. Merge Documents with Similar Filenames: *.mfmf
Create a BAT File
Use any plain text editor (such as Notepad) to create a blank text file. Add the following lines to the file. Make sure to replace paths and filenames with the actual filenames you are using.
The example below shows how to start Acrobat DC and split Test.pdf PDF file using the document splitting settings from SplitProfile.apr file.
SET AUTOSPLIT_INPUT_FILE=C:\Data\Test.pdf
SET AUTOSPLIT_CONFIG_FILE=C:\Data\SplitProfile.apr
SET AUTOSPLIT_BAT_ENABLE=ON
SET AUTOSPLIT_MODE=Split
"C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe" /n /h
The environment variable AUTOSPLIT_INPUT_FILE is used to specify a full file path to the PDF file that needs to be used for the job while AUTOSPLIT_CONFIG_FILE specifies a full file path to the settings file.
The environment variable AUTOSPLIT_MODE is used to specify a processing operation. Here is the list of the supported values:
  • Split - Split Document
  • RenameFile - Auto-Rename PDF Files
  • MergeControlFile - Merge Multiple Documents Using Control File
  • Merge - Merge Documents into Single Document
  • MergeFolders - Merge Documents from Multiple Folders
  • MergeSimilar - Merge Documents with Similar Filenames
Passing a Filename to a BAT File
You can pass a file path to the BAT file to make it run on a specific input file. Make a small modification to the BAT file to allow using parameters. When you call a batch file, you can enter data after the command that the batch file refers to as %1, %2, etc. For example, the following command assigns the first parameter passed to the BAT file to AUTOSPLIT_INPUT_FILE variable.
SET AUTOSPLIT_INPUT_FILE=%1
SET AUTOSPLIT_CONFIG_FILE=C:\Data\SplitProfile.apr
SET AUTOSPLIT_BAT_ENABLE=ON
SET AUTOSPLIT_MODE=Split
"C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe" /n /h
Now pass the file path to a PDF file when executing a BAT file:
AutoSplit.BAT "c:\data\myfiles\document.pdf"
Creating Log Files
Use AUTOSPLIT_LOG_FILE variable to specify a log file location. If a log file does not exist, it will be automatically created. If a log file already exists, then new records will be appended to the file. Log files can be used for troubleshooting and record keeping.
SET AUTOSPLIT_LOG_FILE=C:\Data\AutoSplitLog.txt
Processing a Whole Folder
Only two commands (Split and RenameFile) take input file as a parameter. Alternatively, it is possible to specify a folder instead of an individual PDF file. All PDF files from the folder will be processed one by one. Use AUTOSPLIT_INPUT_FOLDER variable to specify a full path to the processing folder.
AUTOSPLIT_INPUT_FOLDER=C:\Data
Example for "Auto-Rename PDF Files" operation
This is an example of running "Auto-Rename PDF Files" operation:
SET AUTOSPLIT_INPUT_FILE=C:\Data\Test.pdf
SET AUTOSPLIT_CONFIG_FILE=C:\Data\RenameTest.docren
SET AUTOSPLIT_BAT_ENABLE=ON
SET AUTOSPLIT_MODE=RenameFile
"C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe" /n /h
Example for "Merge Multiple Documents Using Control File" operation
Note that all "merge" operations do not use AUTOSPLIT_INPUT_FILE variable, because the input files for the merge are specified as part of the settings. There are typically more than one input file involved. You can use the example below for all 3 merge operations.
SET AUTOSPLIT_CONFIG_FILE=C:\Data\Settings.mergefile
SET AUTOSPLIT_BAT_ENABLE=ON
SET AUTOSPLIT_MODE=MergeControlFile
"C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe" /n /h
Save a BAT File
Save the BAT file with *.bat file extension. Make sure to select a proper file filter in the "Save As" dialog in Notepad to avoid saving the file with a default *.txt file extension.
Run a BAT File
The mail merge job can be executed by double-clicking on the BAT file in Windows File Explorer window or by running it from another application.
Please note that the BAT file will open Adobe Acrobat and may display a progress bar during the processing. Use /h switch on the Acrobat's command line to optionally run Adobe Acrobat minimized:
Starting AutoSplit from a C# Application
Here is a sample C# code that shows how to launch AutoSplit from a .NET application and pass all necessary parameters via the environmental variables.
System.Diagnostics.Process firstProc = new System.Diagnostics.Process();
firstProc.StartInfo.FileName = @"C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe";
firstProc.EnableRaisingEvents = true;
firstProc.StartInfo.UseShellExecute = false;
firstProc.StartInfo.Arguments = @"/n /h"; // pass command-line parameters
firstProc.StartInfo.EnvironmentVariables.Add("AUTOSPLIT_INPUT_FILE", @"C:\Data\Test.pdf");
firstProc.StartInfo.EnvironmentVariables.Add("AUTOSPLIT_CONFIG_FILE", @"C:\Data\Settings.apr");
firstProc.StartInfo.EnvironmentVariables.Add("AUTOSPLIT_BAT_ENABLE", @"ON");
firstProc.StartInfo.EnvironmentVariables.Add("AUTOSPLIT_MODE", @"Split");
firstProc.Start();