The internal command set consists of around thirty commands, each of which can accept one or more arguments that modify its behaviour.
As an example, the internal Copy command's default behaviour is to copy selected files from the source to the destination folder. If you modify its behaviour by specifying the MOVE argument, the command will move selected files rather than copy them.
There are three main types of arguments:
The MOVE argument to the Copy command is an example of a switch argument. So to change a copy button to a move button, the command would be Copy MOVE.
For example, the COPYATTR argument to the Copy command can accept two values - yes or no. Specifying the command Copy COPYATTR would not be sufficient; instead, you would need to specify Copy COPYATTR=yes if you wanted to force the copying of file attributes.
For example, the command Copy ADDTOARCHIVE defaults to creating a Zip archive. In this instance, ADDTOARCHIVE is acting like a switch. If you want to override the default behaviour, and create a 7-Zip archive instead, the command would be Copy ADDTOARCHIVE=.7z.
Each command has what's called a template - a full listing of all of the arguments the command accepts. The template marks each argument with one or more qualifiers to indicate what type of argument it is. You never actually type these qualifiers - they are not part of the argument name, they are merely a clue as to the type of the argument. For example, let's look at the beginning of the template for the Copy command.
ADDTOARCHIVE=ADDTOZIP/O[<default>,fullpaths,nofullpaths], ARCHIVE=ZIP/O[<all>,single,keepfolder], AS/O, BUFSIZE/K/N, BURNCD/S, CLEARREADONLY/K[yes,no]
This is not the whole template, just the first few arguments as an example. Let's take them one at a time:
The qualifiers that you will see in the command templates are as follows. Remember that you never type the qualifiers when using arguments - they are merely a clue as to the argument type.
Qualifier | Type | Description |
---|---|---|
/S | Switch | Indicates a switch argument (a Boolean option that can either be on or off). |
/K | Keyword | Indicates a value argument (a value must be provided following the argument keyword). |
/O | Optional | Indicates an optional argument (can be used either by itself, as a switch, or with a following value). |
/N | Numeric | The value of the argument must be a number. |
/M | Multiple | The argument can accept multiple values (e.g. a list of files; see below). |
/R | Raw | The argument accepts a "raw" value. For these arguments, the rest of the command line following the argument name is taken as the value. Arguments of this type are the only ones that do not require quotes around values which contain spaces. |
Some commands also have an argument that accepts a value, but is not marked with either /K or /O. For example, the FILE argument for the Copy command lets you specify the file or files to copy - and so clearly it takes a value, but it is not marked as such with the /K qualifier. This is a special type of argument - the default argument. In these cases, the use of the argument name itself is optional - you can provide it if desired, but you can also leave it out. For example, Copy FILE C:\foo.txt TO D:\ is equivalent to Copy C:\foo.txt TO D:\. A command can have at most one default argument.
At this point we should discuss the issue of command parsing, spaces, and values. When Opus parses a command line, it uses the template for the command in question to identify the various arguments that you have provided. Take the following example command:
Copy AS My Zip File.zip
The intention of this command is clearly to use the AS argument to provide a new name (My Zip File.zip) for the copied file. The problem that this command line introduces for the command parser is that ZIP is also a valid argument for the Copy command. The embedded spaces in the filename will confuse the command parser - it isn't able to tell that you intended the value of the AS argument to be "My Zip File.zip"
Opus will read the command as containing two arguments, AS (with a value of "My") and ZIP (with a value of "File.zip"). Obviously interpreting the command in this way means it will not behave as intended. To avoid this confusion, whenever you provide a value that contains an embedded space, you must enclose it in quotation marks. The correct form of the command above is:
Copy AS "My Zip File.zip"
This is unambiguous as far as the command parser is concerned - it will see only one argument in the command (AS) and its value will be "My Zip File.zip", as intended.
Within a quoted string, you can use two quote characters to insert a literal quote (VBScript style). This is not useful for filenames, since they can't contain quotes, but can be useful for things like file comments:
SetAttr META "comment:This comment contains ""a quoted phrase""."
An equals sign is generally optional when providing a value for an argument. That is, Copy AS "My Zip File.zip" is equivalent to Copy AS="My Zip File.zip". There are two cases however where one form or the other must be used:
Some arguments accept multiple values. For example, the FILE argument to the Copy command is marked as /M, indicating that you can provide one or more values for the argument. When you do provide multiple values, each value must be separated by spaces. For example:
Copy FILE D:\data\pic*.jpg "J:\image files\pic*.jpg" TO "E:\image store"
This command has two values for the FILE argument - D:\data\pic*.jpg and "J:\image files\pic*.jpg" (note the quotation marks surrounding the second value - as described above, values containing embedded spaces must be quoted).
Just to confuse things further, some value arguments can accept multiple keywords as their value. You should not confuse these with /M arguments, even though it would be easy to do! For example, the Set VIEW command is used to change view mode (e.g. Set VIEW=details), but it can also be used to toggle between two different view modes (e.g. Set VIEW=details,power). In this case, the single argument (VIEW) is taking a single value (details,power) and it is the command itself that interprets this as multiple keywords. VIEW is not marked as /M and therefore the command format Set VIEW details power would not work.
The distinction is subtle and really you don't need to worry about it - each argument is documented as to what sort of values it can accept. It's just worth being aware of the difference.
See the documentation for the individual commands for a full list of their arguments, as well as a description and example of how each argument is used. In many cases multiple arguments can be given at once and the command documentation also describes when and where this would be appropriate.