You are on page 1of 12

Batch Commands

The batch file is a text file that contains a group of MML commands. You can run MML
commands by directly executing the text file instead of entering commands manually.

Note
You can add commentaries for batch commands. The commentary can be in //... or /*...*/
format. The format //... is for the commentary with only one line, and /*...*/ for the
commentary with one or more lines.

Related Topics

Run Immediate Batch Command


Syntax Analysis of Immediate Batch Command
Syntactical Error Description
Set Immediate Batch Command
Run Time-Based Batch Command
Add Batch Task
Syntax Analysis of Time-Based Batch Command
Modify Batch Task

Run Immediate Batch Command


You can log in to the system, create or open a batch file, perform syntax analysis, set
parameters of the immediate batch command, and then run the immediate batch
command. You can also create or open a batch file and perform syntax analysis in offline
mode.

Operation
To run the immediate batch command, perform the following steps:
1.
Choose System > Batch Commands or press Ctrl+E. The MML
Batch interface appears.
2.
Select Immediate Batch Command.
3.
Click New and enter the batch command in the entry box.
4.
You can also click Open to select and open the batch file. The file name of the
immediate batch file appears on the title bar of the interface.
5.
Click Analyze Syntax to perform primary and senior syntax analysis of the batch file
added or opened. For details, see Syntax Analysis of Immediate Batch Command.

Note:

If you do not click Analyze Syntax, the system automatically performs


primary syntax analysis of the batch file after you click Go in step 8.

In offline mode, you can create or open a batch file and perform syntax
analysis, but you cannot click Go or perform related operations as described below.
6.
Click Set and set the related parameters. For details, see Set Immediate Batch
Command.
7.
The line No. is displayed on the left of a line. The line No. of the line in which the
cursor is placed is in red. Click the left of a line and set a breakpoint for the help. Click it
again, the breakpoint is cancelled.

8.

Click Go and the system runs the batch command. After the execution, the following
results appear on the status bar of the MML Batch interface:

Total Results: Indicates the general results of the execution, including the
number of successful and failed commands.

Current Result: Indicates the execution result of the latest command that is
executed.

Time Used: Indicates the time used for the execution. The format is
HH:MM:SS. Here, HH, MM, and SS represent hour, minute, and second respectively.
The time used for the execution is from the time when the execution starts to the time
when the execution is complete or being paused manually. When a batch task is
paused or the execution reaches a breakpoint, the timing stops. When you create or
open a batch file, the time used is cleared.

Cursor Position: Indicates the position of the command being executed,


identified by line and column. It indicates the progress during the execution of a batch
command. After a batch command is executed, the cursor moves to the start position
automatically.

If a command is found to be incorrect during the batch command processing,


the prompt indicating "Execution failed. Continue?" appears.

If you click Yes, the LM continues to run the subsequent commands.

If you click Yes to All, the LM continues the batch command processing but
does not display such a prompt even another command error is found.

If you click No, the LM stops the batch command processing. In this case, if
you click Go, the LM runs the commands from the first line.

If you click Details, the detailed information on the command is displayed.


9.
Click Pause or Stop to pause or stop the batch file being executed.
10.
Reset the cursor in the batch commands edit box, and press Ctrl + a number key to
set tags or cancel the bookmark setting.

Note

The size of the batch file to be opened cannot exceed 4 MB.


In offline mode, the setting of parameters of the immediate batch command is invalid.
The tags are divided into three types: error tag, breakpoint, and bookmark. An error
tag is the mark automatically made to the line with incorrect execution result during
batch command execution. A breakpoint is set by the operator by clicking the left of a
line for breakpoint execution mode. A bookmark is automatically added to the line in
which the cursor is placed after the operator presses Ctrl + a number key. When the
operator presses Alt + a number key, the cursor moves to the bookmark that is set
already.
During the batch command processing with Execution Type set to All, Breakpoint,
or Range, the batch command processing is paused when you click Pause. In this case,
if you click Go, the LM runs the commands from the paused line. During the batch
command processing with Execution Type set to All, Breakpoint, or Range, the batch
command processing is stopped when you click Stop. In this case, if you click Go, the
LM runs the command from the first line.
For a batch file that contains a large number of commands,
select Find or Replace on the shortcut menu to edit the commands, and select Save
as on the shortcut menu or clickSave to save the modification.
The batch execution result is saved to a specified file which is locked. You can
click Set to check the save path. To open this file, you should click New, or open another
batch file, or close the active batch interface firstly.

Parameter
Parameter

Description

All

Indicates that all the commands are executed.

Step by
Step

Indicates that commands are executed step by step, that is,


only one command is executed at a time.

Execution
Indicates that the batch command processing is paused at
Type
Breakpoint the breakpoint if the breakpoint is set. In this case, you must
click Go to continue the processing.
Range

Prompt when Error


Occurs

Indicates that the commands between the specified lines are


executed.
If it is selected, the system displays the prompt "Execution
failed. Continue?" when the commands are executed
unsuccessfully. If you click YES, the system continues the
execution and the prompt is displayed if the execution fails
again. If you click Yes to ALL, the system continues the
execution and the prompt is not displayed even if the
execution fails again. (When the execution type is set
to Step by Step, the Yes to ALL button does not exist). If
you click NO, the system stops the execution. You can
click Detail to browse the detailed information.
If it is not selected, the prompt is not displayed when the
execution fails.

Syntax Analysis of Immediate Batch Command


To find and correct the errors found in the batch command as soon as possible and to
improve execution efficiency of the immediate batch command, the LM provides syntax
analysis for the immediate batch file.
You can analyze the syntax of all the text lines or a single text line added to the command
edition area.

Syntax Analyze for All Text Lines


Click Analyze Syntax to perform primary and senior syntax analysis of all the text lines.
The following cases may occur:

If no text exists in the command edition area, the system displays "No command in
this file."

If there are texts but no command lines in the command edition area (there are only
comments, spaces, or line feed characters), or if there are command lines but no
syntactical error is found, the system displays "Analyzing the syntax is complete. No
syntactical error exists." after the syntax analysis is complete and the process bar
disappears.

If there are command lines, and syntactical errors are found, the system adds a
syntactical error label on the left label bar and an error statistical label (shown as
) on
the right label bar after the syntax analysis is complete and the process bar disappears.
The Result Information dialog box appears. You can click Save As in the dialog box to
save the error information.

Note:
When you move the cursor to the error statistical label, the statistical information on the
syntactical error found during the analysis is displayed.
The following describes certain notes on the syntax analysis of all the text lines:

Syntactical errors can be classified into primary syntactical errors with the label
and senior syntactical errors with the label . When you move the cursor to a
syntactical error label, the corresponding syntactical error information is displayed. For
details, see Syntactical Error Description.

After you click Analyze Syntax, the system automatically clears the existing
syntactical error labels on the left and right label bars of the command edition area. If no
syntactical error is found, neither a syntactical error label nor an error statistical label is
displayed on the left and right label bars. If a syntactical error is found, a syntactical
error label and an error statistical label are displayed on the left and right label bars.

The Result Information dialog box is the table consisting of three columns,
namely, Line No, Type, and Reason. The table lists the number, error type (error or
warning), and cause of the command line. You can click on a column header to
sequence the information in each column. Line No is sequenced according to the
numeral. The other two columns are sequenced according to the size of the character
string.

After you correct the errors found, you can analyze the syntax of the modified
command line according to the methods described in "Syntax Analysis for a Single Text
Line".

Syntax Analysis for a Single Text Line


To perform primary and senior syntax analysis of a single line, right-click a command line
and select Analyze Current Line; alternatively, select a command line and press Ctrl+T.
The following cases may occur:

If no syntactical error is found, no label is displayed on the left and right label bars.

If a syntactical error is found, a label is displayed on the corresponding location of the


left and right label bars.
After you correct the errors found, you can analyze the syntax of the modified command
line according to the methods described in "Syntax Analysis for a Single Text Line".

Note

When analyzing the syntax for a command line, the system stops the syntax analysis
on this line if a syntactical error is found. This syntactical error is deemed as the result of
the syntax analysis on this line.
When analyzing the syntax for the whole text, the system automatically stops the
syntax check if 1000 syntactical errors are found, and the prompt "There are 1000 lines
of syntactical errors. The syntax check will stop." appears. The system can perform the
syntax analysis on a text line, however.
The result of the syntax analysis can be saved as txt files only.
When a command line with a syntactical error label is deleted, the syntactical error
label is deleted.

Syntactical Error Description


After finding a syntactical error in a command line, the system adds a syntactical error label
on the left label bar and an error statistical label on the right label bar.

Syntactical errors can be classified into primary syntactical errors and senior syntactical
errors based on error types.

Primary Syntactical Error


Primary syntactical errors are basic format errors or visibility errors of commands found
during the syntax analysis, shown as
in the left label bar.
1.
The following cases lead to basic format errors:

The command line does not end with a semicolon.

The command line contains more than one colon.

The command line ends with more than one semicolon.

The command line does not contain a colon.


2.
The following cases lead to visibility errors:

The command is incorrect. That is, the command name is incorrect, or a


disaster recovery command is used in non-disaster recovery mode.

The command is a system command and cannot be executed on a common


maintenance console.

The command is a non-local command and cannot be executed on the LM.


That is, the command should be used in the network management integrated
environment, but it is used in a single node environment.

Senior Syntactical Error


Senior syntactical errors are errors related to command integrality or parameter integrality
found during the syntax analysis, shown as
in the left label bar.
1.
The following cases lead to command integrality errors:

A mandatory parameter of the command is not specified.


2.
The following cases lead to parameter integrality errors:

The parameter name is incorrect.

The value of a parameter is out of range.

The length of a parameter value is out of range.

A parameter is redundant.

Some parameters are identical.

The format of a parameter is incorrect. That is, the parameter value is not
expressed in the formal A=B. For example, no value is placed before or after "=", or
"=" is missing.

A parameter value is illegal, containing illegal characters.

A parameter is set to more than one value.

Note

All the command character strings contained in the syntactical error information are
capitalized.
When analyzing the syntax for a command line, the system stops the syntax analysis
on this line if a syntactical error is found. This syntactical error is deemed as the result of
the syntax analysis on this line. That is, only one syntactical error is labeled for a
command line.

Set Immediate Batch Command

To meet the requirements of browsing execution results of the immediate batch commands,
the LM provides a function to save the results of immediate batch commands. You can
save the execution results to a specified file.

Operation
To set the immediate batch commands, perform the following steps:
1.
Click Set on the Immediate Batch Command interface. The Set dialog box appears.

2.

Set the time interval. Thus, after running a batch command, the system waits for the
set time interval before running the next command. By default, it is set to 0.
3.
You can choose whether to save failed commands and set the path. By default, the
system saves the failed commands and provides a path.

Note:
The default path for saving the failed commands is: <installation
directory>\client\output\<product name>\<version information>\batch. The
default file name is failResult_YYYY-MM-DD-HH-MM-SS.txt. Here, YYYY-MMDD-HH-MM-SS stands for year, month, date, hour, minute, and second
respectively, which is the time when you open or create a batch file, so it is
different when you open or create a batch file each time.
4.

Save the results. You can choose to save successful results, failed results, both
successful and failed results, or neither successful nor failed results. By default, the
system saves the failed results and provides a path. You can also specify another file to
store the results.

Note:
The default path for saving the results is: <installation
directory>\client\output\<product name>\<version information>\batch. The
default file name is BatchMML_Result_YYYY-MM-DD-HH-MM-SS.txt. Here,
YYYY-MM-DD-HH-MM-SS stands for year, month, date, hour, minute, and
second respectively, which is the time when you open or create a batch file, so it
is different when you open or create a batch file each time.

Note

When the size of the saved file exceeds 5 MB, the system creates a new file automatically.
The principle of the new file is as follows: The name of the first created file is the original
file name added with "_1". The names of the subsequent files increase by 1 automatically.
For example, if the name of the currently saved file is BatchMML_Result_2006-04-17-1013-38.txt, the name of the first created file is BatchMML_Result_2006-04-17-10-1338_1.txt, and the name of the subsequently created file is BatchMML_Result_2006-0417-10-13-38_2.txt, and so on.

Find
Operation
1.

Right-click in the window and select Find, or press Ctrl+F. The Find dialog box
displays.

2.
3.
4.
5.

Enter the keyword in the Find What.


Set the mode Match Case, Match Whole Word Only and Use Wildcards.
Select the find direction, the default is Down.
Click Find Next.

Note

When the last record is found, the system displays "Searching is completed" if you
click Find Next. If it is not found, the system displays that the keyword is not found.
When using the wildcards for searching, the system searches the texts that map the
object text in one line. When Use Wildcards is chosen, Match Case and Match Whole
Words Only are unavailable. The wildcard search supports using the wildcards ? and *.
The ? represents any single character, and * represents any series characters.

Replace
Operation
1.

Right-click in the window and select Replace, or press Ctrl+H. The Replace dialog
box displays.

2.
3.
4.
5.
6.

Enter the keword to find in the Find What.


Set the find mode Match Case and Match Whole Only.
Select the replace area, the default is Whole file.
Click Find Next, if find the matching keyword, click Replace.
Click Replace All to perform the operation in the selected area for one time.

Run Time-Based Batch Command


The time-based batch command provides the function of executing batch files at the
specified time.

Operation
To run the time-based batch commands, perform the following steps:
1.
Choose System > Batch Commands or press Ctrl+E. The MML
Batch interface appears.
2.
Select Timing Batch Command. Click the buttons on the right side to perform the
following operations:

Add: For details, see Add Batch Task. The button is available after the
interface is opened. You can add batch tasks to the task list through the Add button.

Delete: Select a batch task in the task list, and click Delete or
press Delete on the keyboard. The selected batch task is deleted. The time-based
batch commands in the status of waiting, interrupted, and finished can be deleted.
Those in the status of running cannot be deleted.

Modify: For details, see Modify Batch Task.

Pause: Select a batch command being executed and click Pause, the
execution of the batch command pauses. The status of the batch task being paused
is Pause.

Continue: Select a batch command being paused and click Continue, the
execution of the batch command continues.

Stop: Select a batch command being executed and click Stop, the execution
of the batch command stops.

Note
1.

For a batch task being paused, if you click Stop, the execution of the batch
command is stopped forcibly, and the Continue button is changed to the Pause button,
which is unavailable.

2.

When a task being paused exists in a task list, other tasks cannot be executed even
if it reaches the execution time.
3.
The system processes only one time-based batch task at a time but supports
processing several batch tasks continuously.

It is time for task B to be processed but the execution of task A is not


completed. In this case, task B is in waiting status. Task B is processed only after the
execution of task A is completed.

It is time for task B and C to be processed but the execution of task A is not
completed. After the execution of task A is completed, the one with the earlier
execution time is processed first. If the execution time of task B and C is the same,
the one with the earlier creation time is processed first. When the system starts to
process the task and two tasks are required to be processed, the one with earlier
execution time or earlier creation time is processed first.

It is time for several tasks to be processed but the execution of task A is not
completed. The one with earlier execution time is processed first. If the execution time
of all the waiting tasks is the same, the one with the earlier creation time is processed
first.

Add Batch Task


After the batch files are added and passed syntax analysis, you can set the time to process
the batch files, and set whether to save the execution results.

Operation
To add a batch task, perform the following steps:
1.
Choose System > Batch Commands or press Ctrl+E. The MML
Batch interface appears.
2.
Select Timer Batch Command.
3.
Click Add. The Add Batch Task dialog box appears.

4.

Select a batch file and click Analyze Syntax to perform primary and senior syntax
analysis of the added batch file. For details, see Syntax Analysis of Time-Based
Batch Command.

Note:
If you do not click Analyze Syntax, the system automatically performs primary
syntax analysis of the batch file after you click OK in step 8.
5.

Set the execution time and interval for sending commands.

Note:
Sending Commands interval(s) means the time interval of two adjacent
commands being processed. By default, it is set to 0.
6.

You can choose whether to save failed commands. By default, the system saves the
failed commands and provides a path. You can also specify a path and file name.
7.
Save the results. You can choose to save successful results, failed results, both
successful and failed results, or neither successful nor failed results. By default, the
system saves the failed results and provides a path.
8.
Click OK and the task is added in the task list.

Note

The default path for saving the results is: <installation


directory>client\output\<product name>\<version information>\batch. The default file
name isBatchMML_ExecuteResult_DATETIME.txt, where DATETIME is the character
string of the setting time, such as 2006-04-27-10-13-38, which stands for year, month,
date, hour, minute, and second respectively.
When the size of the saved file exceeds 5 MB, the system creates a new file
automatically for saving files. The file name of the new file is the original file name added
with _1. For example, if the name of the currently saved file
is BatchMML_ExecuteResult_2006-04-27-10-13-38-04.txt, the name of the newly
created file is BatchMML_ExecuteResult_2006-04-27-10-13-38-04_1.txt.
Save Failed Commands and Save Results provide the function to memorize the
path. When you select a path, the system takes this path as the default one when
adding a batch task next time.
After the execution, the number of successful commands and that of failed
commands appear directly.

Syntax Analysis of Time-Based Batch Command


To find and correct the errors found in the batch command as soon as possible and to
improve execution efficiency of the time-based batch command, the LM provides syntax
analysis for the time-based batch file.

Operation
Click Analyze Syntax to perform primary and senior syntax analysis of the added batch
file.
The following cases may occur:

If the batch file does not exist or cannot be opened, the system displays "The batch
file XXX does not exist or cannot be opened. Please select another batch file". XXX
indicates a text file with an integrated path, such as D:\Text Document\New Text
Document.txt.

If the batch file is empty, that is, if the size of the batch file is 0, the system displays
"No command in this file."
If the batch file does not contain a command line (there are only comments, spaces,
or line feed characters), or no syntactical error is found, the system displays "Analyzing
the syntax is complete. No syntactical error exists." after the syntax analysis is complete
and the process bar disappears.
If the batch file contains command lines and syntactical errors are found, the Result
Information dialog box appears after the syntax analysis is complete and the process
bar disappears. You can click Save As in the Result Information dialog box to save the
error information.

Note:
The Result Information dialog box is a table consisting of three columns, namely, Line
No, Type, and Reason. The table lists the number, error type (error or warning), and cause
of the command line. You can click on a column header to sequence the information in
each column. Line No is sequenced according to the numeral. The other two columns are
sequenced according to the size of the character string.

Note

When Batch File is not specified, the Analyze Syntax button is unavailable.
When analyzing the syntax for a command line, the system stops the syntax analysis
on this line if a syntactical error is found. This syntactical error is deemed as the result of
the syntax analysis on this line.
When analyzing the syntax for the whole text, the system automatically stops the
syntax check if 1000 syntactical errors are found, and the prompt "There are 1000 lines
of syntactical errors. The syntax check will stop." appears.
The results of the syntax analysis can be saved as txt files only.

Modify Batch Task


You can modify the setting to modify the batch task.

Operation
To modify a batch task, perform the following steps:
1.
Select an added batch task on the Timer Batch Command tab.
2.
Click Modify, or press Enter on the keyboard, or double-click the batch task.
The Modify Batch Task dialog box appears.

Note:
If you double-click a batch task in running state, the Modify Batch Task dialog
box does not appear.
3.

Reselect a batch file and click Analyze Syntax to perform primary and senior syntax
analysis of the batch file to be added. For details, see Syntax Analysis of Time-Based
Batch Command.

Note:
If you do not click Analyze Syntax, the system automatically performs primary
syntax analysis of the batch file after you click OK in step 5.
4.
5.

Set the execution time. Choose whether to save failed commands.


Click OK.

Note
Do not modify a batch task in running state. After the modification, a batch task is in waiting
state.