Management and Security powered by Landesk

> Distribution > Local Scheduler > Local scheduler character parsing and the command line

Local scheduler character parsing and the command line

The local scheduler uses standard white space-delimited parsing for the command line. This means that if any of the parameters contain white space they need to be enclosed in quotation marks. Certain parameters, such as /start, always contain white space and hence always need to be quoted. Other parameters, such as /exe and /cmd, may or may not contain white space and may or may not need to be quoted.

The following example shows a command line that does not need quotation marks.

LocalSch.exe /exe=c:\windows\system32\cmd.exe

The following example shows a command line that does need quotation marks.

LocalSch.exe /exe="%ProgramFiles%\MyProgram\myprog.exe" /cmd="/apm /s /ro"

Quoting already quoted parameters

If the parameters that are to be passed to /cmd= are already quoted, then three quotes are required: one set to quote the entire string, another to quote the quoted values, and the third for quoted values.

For example, the following command line shows an example of parameters that need to be surrounded by three quotation marks.

LocalSch.exe /exe="%ProgramFiles%\LANDesk\File Replicator\LANDeskFileReplicatorNoUI.exe" /cmd="""%ProgramFiles%\LANDesk\File Replicator\LDHTTPCopyTaskConfig.xml"" ""%ProgramFiles%\LANDesk\File Replicator\replicator.log"""

In the above command, the two parameter are paths to files. Because both paths are in the “Program Files” directory, the paths have spaces and must be quoted in order to be proper parameters for LANDeskFileReplicatorNoUI.exe. So each quoted parameter is surrounded by a second set of quotes, and then the entire string is surrounded by quotes.

Quoting redirection operators

Quotes must also surround any switches that contain a redirection operator. Redirection operators include the following symbols: <, >, |. The /bw switch uses a | character called a pipe or bar. It is important to remember that the | character is used in the command prompt to pipe the output to another application. To prevent this character from being parsed by the command line, it must be surrounded with quotes.

For example, the following command uses a /bw parameter with a | character and needs to be quoted.

LocalSch.exe /exe=C:\ldclient\myprogram.exe /cmd="/apm /s /ro" /bw="LAN|server"

Was this article useful?    

The topic was:



Not what I expected