Use Command-Line Parameters [InfoPath 2003 SDK Documentation]
- Microsoft Office InfoPath 2003
- Microsoft Office InfoPath 2003 Service Pack 1
You can start Microsoft Office InfoPath in a Command Prompt window. You can apply a number of parameters to perform a variety of tasks in InfoPath, such as opening a new form or an existing form, setting the default location for saving a new form, merging forms, opening a form in design mode, opening an existing form for reading only, and saving it only in a location you specify. Square brackets  indicate optional parameters.
[file path]INFOPATH.EXE [[URL]filename] [/aggregate] [/cache clearall] [/defaultsavelocation [URL]] [/design [formtemplate]] [/new [form|formtemplate]] [/readonly]
[file path] specifies the optional file path for Infopath.exe. Either Infopath.exe must be in the current directory or in the user's file search PATH, or the optional [file path] must specify an absolute or relative path to Infopath.exe. Spaces must either be encoded (%20), or the entire path or URL must be surrounded by quotes ("). For example, C:\Program%20Files\Microsoft%20Office\OFFICE11\INFOPATH.EXE.
[[URL]filename] specifies the optional form or form template file to open when InfoPath launches. If you specify a relative path or do not specify any path for the file, the current directory is used as the root. The file opens by default in the editor, unless you specify the /design option. If you specify a form name, the form is opened for editing; if you specify a form template name, a new form that is based on the form template is opened.
The following table describes each of the InfoPath command-line options.
|/aggregate <form1|form2|form3> <formtemplate>||With this option, InfoPath merges the forms in the form list into a single form based on a form template (.xsn). Individual form names in the form list should not be enclosed by quotations, but the entire form list can be enclosed by quotations. The form names must be separated by a "|" (pipe) character. The form template used to perform the merge must also be specified. InfoPath begins the merge by using the default data for the form template.|
|/defaultsavelocation <URL>||The Uniform Resource Locator (URL) from the /defaultsavelocation option becomes the search path for the Save As dialog box the first time the form is saved. The /defaultsavelocation option is disregarded unless the /new option is also specified. Any valid save location other than a root directory can be specified. Any necessary character encoding of the URL must be done by the caller.|
|/design <formtemplate>||If no form template is specified, InfoPath will be opened in design mode, and no file will be opened. If a form template is specified, InfoPath will display the Design Tasks task pane. If a form is specified, the /design flag will be ignored, and the form will be opened in edit mode.|
|/new <form|formtemplate>||With this option, InfoPath opens a new form based on an existing form or form template, without automatically setting the default location for saving files, and the form is added to the list of most recently used files. If no form or form template is specified, InfoPath will open without loading a form. You can use this option in combination with the /defaultsavelocation option. The name of the form or form template can be a file name, a fully-qualified path and file name, or a Uniform Resource Name (URN).|
|/readonly||The /readonly flag should be used together with the /design <form template> option. In this scenario, you can only save a form using the Save As command.|
The following combinations of arguments are acceptable:
- /aggregate /defaultsavelocation /new
- /design /defaultsavelocation
Other combinations of arguments are not acceptable and will result in an error message being displayed.
In this example, the /new option is used to open a new form and to set the default location for saving files:
InfoPath.exe /new "MyForm.xml" /defaultsavelocation "C:\MyForms"
In this example, the /aggregate option is used to merge the XML data from two forms into one form that is based on the specified form template:
InfoPath.exe /aggregate "MyForm1.xml|MyForm2.xml" "MyForm.xsn"
In this example, the /design option is used to open a form template in design mode:
InfoPath.exe /design "MyForm.xsn"