MapForce Command Line Interface
The general syntax of a MapForce command at the command line is as follows:
MapForce.exe <filename> [/{target} [[<outputdir>] [/options]]]
For more information about each parameter of the command, see Parameters below.
Notation
The following notation is used to indicate command line syntax:
Notation | Description |
---|---|
Text without brackets or braces | Items you must type as shown |
<Text inside angle brackets> | Placeholder for which you must supply a value |
[Text inside square brackets] | Optional items |
{Text inside braces} | Set of required items; choose one |
Vertical bar (|) | Separator for mutually exclusive items; choose one |
Ellipsis (...) | Items that can be repeated |
Parameters
<filename>
The mapping design (.mfd) or mapping project (.mfp) (Professional and Enterprise editions) from which code is to be generated.
/{target}
Specifies the target language or environment for which code is to be generated. The following code generation targets are supported:
•/XSLT
•/XSLT2
•/XSLT3
<outputdir>
Optional parameter which specifies the output directory. If an output path is not supplied, the current working directory will be used. Note that any relative file paths are relative to the current working directory.
/options
The /options are not mutually exclusive. One or more of the following options can be set:
•The /GLOBALRESOURCEFILE <filename> option is applicable if the mapping uses Global Resources to resolve an input or output file, folder paths, or databases. For more information, see Altova Global Resources. The /GLOBALRESOURCEFILE option specifies the path to a Global Resource XML file. Note that, if /GLOBALRESOURCEFILE is set, then /GLOBALRESOURCECONFIG must also be set.
•The /GLOBALRESOURCECONFIG <config> option specifies the name of the Global Resource configuration (see also the previous option). If /GLOBALRESOURCEFILE is set, then /GLOBALRESOURCECONFIG must also be set.
•The /LOG <logfilename> option generates a log file at the specified path. The <logfilename> path can be an absolute path. If a full path is supplied, the directory must exist for the log file to be generated. If you specify only the file name, the file will be placed in the current directory of the Windows command prompt.
Notes
•Relative paths are relative to the working directory, which is the current directory of the application calling MapForce. This applies to the path of the .mfd filename, output directory, log filename, and global resource filename.
•Do not use the end backslash and closing quote at the command line (e.g., "C:\My directory\"). These two characters are interpreted by the command line parser as a literal double quotation mark. It is recommended to avoid using spaces and quotes. If spaces occur in the command line and you need the quotes, use the double backslash (e.g., "c:\My Directory\\").
Examples
1) To start MapForce and open the mapping <filename>.mfd, use the following command:
MapForce.exe <filename>.mfd
2) To generate XSLT 2.0 code and create a log file with the name <logfilename>, use the following command:
MapForce.exe <filename>.mfd /XSLT2 <outputdir> /LOG <logfilename>
3) To generate XSLT 2.0 code taking into account the global resource configuration <grconfigname> from the global resource file <grfilename>, use the following command:
Mapforce.exe <filename>.mfd /XSLT2 <outputdir> /GLOBALRESOURCEFILE <grfilename> /GLOBALRESOURCECONFIG <grconfigname>
Examples for Professional and Enterprise editions
1) To generate a C# application for Visual Studio 2022 and output a log file, use the following command:
MapForce.exe <filename>.mfd /CS:VS2022 <outputdir> /LOG <logfilename>
2) To generate a C++ application using the code generation settings defined in Tools | Options and output a log file, use the following command:
MapForce.exe <filename>.mfd /CPP <outputdir> /LOG <logfilename>
3) To generate a C++ application for Visual Studio 2022, MSXML, with static libraries, MFC support, and no log file, use the following command:
MapForce.exe <filename>.mfd /CPP:VS2022,MSXML,LIB,MFC
4) To generate a C++ application for Visual Studio 2022, Xerces, with dynamic libraries, no MFC support, and a log file, use the following command:
MapForce.exe <filename>.mfd /CPP:VS2022,XERCES,DLL,NoMFC <outputdir> /LOG <logfilename>
5) To generate a Java application and output a log file, use the following command:
MapForce.exe <filename>.mfd /JAVA <outputdir> /LOG <logfilename>
6) To generate code for all mappings in the project, using the language and output directory defined in the folder settings (of each folder inside the project), use the following command:
MapForce.exe <filename>.mfp /GENERATE /LOG <logfilename>
7) To generate Java code for all mappings in the project file, use the following command:
MapForce.exe <filename>.mfp /JAVA /LOG <logfilename>
Note that the code generation language defined in the folder settings are ignored, and Java is used for all mappings.
8) To supply input and output files at the command line for a previously compiled Java mapping, use the following command:
java -jar <mappingfile>.jar /InputFileName <inputfilename> /OutputFileName <outputfilename>
The /InputFileName and /OutputFileName parameters are the names of special input components in the MapForce mapping that allow you to use parameters in command line execution (see Supplying Parameters to the Mapping).
9) To compile a mapping to a MapForce Server execution file for MapForce Server version 2025 and suppress XML signatures, use the following command:
MapForce.exe <filename>.mfd /COMPILE:NOXMLSIGNATURES <outputdir> /MFXVERSION:2025 /LOG <logfilename>