Using Command Lines

The Monarch Utility allows the use of command lines, specifically for file preparation functions, which may be used on a recurring basis.

The steps below are performed to execute a supported Monarch Utility command.

  1. Open Windows Command Prompt.

  2. Go to C:\Program Files\Altair Monarch 2024\.

  3. Execute the function as follows: monarchutility.automation.exe <command>

Example: monarchutility.automation.exe "C:\Monarch Classic\Monarch Utility\Command Line\Source" "-f:*.dpwx;" -isf /ccw /all /skipw

 

Supported Commands

Replace Strings

Command: <source file> <target file> /cr <search string> <replace string>

where:

/cr means "run string replacement".

<search string> - The string on which to perform the replacement. The string must be enclosed by quotes.

<replace string> - The string with which to replace the search string. The string must be enclosed by quotes. This argument is optional; if omitted, the search string will be deleted.

/chset - <character set> - The values of ansi or ascii indicate which character set to use for both the strings and the input file. This argument is optional; if not specified, /chset:ascii will be assumed.

 

Example: "c:\test\test.prn" "c:\test\test1.prn" /cr "./n/n" ".00" /chset:ansi

Note: It is possible to loop through an entire folder using batch scripting in the following way, with a batch file containing the following line executing the search-and-replace command on every file with the extension .prn in c:\test folder:

FOR %%f IN ("c:\test\*.prn") DO "c:\monarchutility.automation.exe" %%f %%f /cr "./n/n" ".00" /chset:ansi

 

Insert Line Breaks into Continuous Stream Files

Command: <source file> <target file> /nr <segmentlength>

where:

/nr means "run insert line breaks".

<segmentlength> - The length of the new lines.

 

Example: "c:\test\test.prn" "c:\test\test1.prn" /nr 500

 

Insert Line Breaks into Files with Line Lengths Greater than 4000 Characters

Command: <source file> <target file> /lr <linelengths>

where:

/lr means "run long lines".

<linelengths> - Line lengths separated by spaces.

 

Example: "c:\test\test.prn" "c:\test\test1.prn" /lr 2000 2000 2000

 

EDI Format Preparation

Command: <source file> <target file> /edi <params>

where:

/edi means "run edi transformation and auto detect parameters".

 

The following parameters may be specified after /edi:

segment delimiter - /segd:character (ex /segd:' )

element separator - /elem:character (ex /elem:: )

sub element separator - /sube:character (ex /sube:+ )

release character - /rele:character (ex /rele:? ) This argument is optional but all others must be in the list if not using the auto detect parameters syntax.

The target file argument is optional and the order of parameters is irrelevant. The characters can be wrapped in quotes if necessary, i.e., /sube:" "

 

Example: "c:\test\test.prn" "c:\test\test1.prn" /edi /segd:’ /elem:: /sube:+

When run in command line, Monarch Utility returns a zero if all was successful. If an error occurred, Monarch Utility returns a value of 1. When Monarch Utility is run in a batch file, the code can test for a return value of 1 and act accordingly.

 

Convert Text/XML Models or Projects to the Binary Format

Single File

Command: <source file> <target file> /cnv

Example: "c:\test\test.xmod" "c:\test\test.dmod" /cnv

Multiple Files

Command: <source folder> -f:<filenames> -isf <target folder> -psf /cnv

Example: "c:\test\from" "-f:*.xmod;*.xprj;" -isf "c:\test\to" -psf /cnv

where:

<filenames> - name of the file you want to utilize (i.e., the model or project file) or enter a wildcard and the appropriate extension (e.g., *.dmod).

-isf - include any files in all subfolders of the specified source folder (optional).

-psf - preserve folder structure of the <source folder> in <target folder> (optional).

 

Redact Sample Lines

Command: <source folder> -f:<filenames> -isf  /rsl <parameters>

where:

-f:<filenames> - specifies the files you want to scrub, e.g., *.dmod (optional)

-isf - include any files in all subfolders of the specified source folder (optional)

 

The following parameters may be specified after /rsl:

/skipm - Skip Models with any templates in Floating or Regx mode (optional)

/skipw - Skip Workspaces saved by version older than the current engine version, i.e., less than minor (Major.Minor.Patch) (optional)

 

Example: "c:\test\modelsAndWorkspaces" "-f:*.dmod;*.dpwx;" -isf /rsl /skipm

 

Clear Credentials from Projects and Models

Command: <source folder> -f:<filenames> -isf /ccpm <parameters>

where:

-f:<filenames> - specifies the files you want to scrub, e.g., *.dmod (optional)

-isf - include any files in all subfolders of the specified source folder (optional)

 

The following parameters may be specified after /ccpm:

/el - Clear External Lookup Passwords (optional)

/db - Clear Database Passwords (optional)

/rpt - Clear Report Passwords (optional)

/http - Clear HTTP Usernames and Passwords (optional)

/ftp - Clear FTP Usernames and Passwords (optional)

/s3 - Clear Amazon S3 Login Info (optional)

/zip - Clear Zip Archive Passwords (optional)

/all - Clear all credentials (optional)

If no optional flags are used, then no credentials will be cleared.  If optional credential flags are used then only those credentials will be cleared.

 

Example: "c:\test\projectsAndmodels" "-f:*.dmod;*.dprj;" -isf /ccpm /db /rpt

 

Clear Credentials from Workspaces

Command: <source folder> -f:<filenames> -isf /ccw <parameters>

where:

-f:<filenames> - specifies the files you want to scrub, e.g., *.dpwx (optional)

-isf - include any files in all subfolders of the specified source folder (optional)

 

The following parameters may be specified after /ccw:

/skipw - Skip Workspaces saved by version older than the current engine version, i.e., less than minor (Major.Minor.Patch) (optional)

/user - Clear Usernames (optional)

/at - Clear Access Tokens (optional)

/sk - Clear Secret Keys (optional)

/ai - Clear Account Ids (optional)

/sae - Clear Service Account Emails (optional)

/rt - Clear Refresh Tokens (optional)

/all - Clear all credentials (optional)

 

Example: "c:\test\workspaces" -f:*.dpwx -isf  /ccw /user /sae /skipw

Passwords are always cleared. If no optional flags are used, then only passwords will be cleared. If optional credential flags are utilized, only those and passwords will be cleared.

 

Bulk Upgrade of Deprecated Data Connections

Command: <source folder> -f:<filenames> -isf <target folder> -psf /udc <parameters>

where:

-f:<filenames> - specifies the name(s) of the workspace or library file(s) you wish to upgrade; alternatively, you can enter a wildcard and the appropriate extension (e.g., *.dpwx; *.dpsv)

-isf - includes any files in all subfolders of the specified source folder (optional)

-psf - preserves the folder structure of the <source folder> in the <target folder> (optional)

 

The following parameter may be specified after /udc:

/td:<template directory> - specifies the directory that contains the migration templates to use for the upgrade (optional)

 

Example: "c:\test\from" -f:".dpwx;*.dpsv;" -isf "c:\test\to" -psf /udc /td:"c:\test\templates" 

 

Display the Monarch Utility Commands

Command: /?

 

 

© 2024 Altair Engineering Inc. All Rights Reserved.

Intellectual Property Rights Notice | Technical Support