Variable Syntax and Usage
Variables are called using SH syntax, which is the syntax of the standard UNIX
shell. For example, if you want to refer to a variable called USER,
include ${USER} in the Exec property of the command.
The following "Hello World" example shows how you can use variables in a command
that would work on a WindowsNT or Windows2000 machine. In the example, a variable
called MESSAGE with a value of "Hello World" is
created and used in a command called SHOWMESSAGE, which calls the system's echo
command. No files on your system will be changed by following this example.
To see a simple example of variable usage:
- Open the New Generic VCS wizard by choosing Versioning
Mount
Version Control
Generic VCS.
- In the Version Control System Profile combo box, select Empty (yourOS).
- If you prefer, browse to a directory in the Working Directory field. For
the purposes of this example, you can leave the default working directory.
No files will be changed by following this example. Click Next to proceed.
- Click the Edit Variables button to open the Variable Editor dialog box.
- Right-click the Accessory node and choose New Variable from the contextual
menu. Type MESSAGE in the text field and click OK.
- Expand the Accessory node and select the MESSAGE node that you just created.
- In the property sheet on the right side of the dialog box, select the Value
property and type:
Hello World
- Click OK to close the variable editor. Then click Edit Commands.
- Right-click the Empty node and choose Add
Command. Be careful to click
the Empty node and not the node above it labeled Empty (yourOS). Type SHOWMESSAGE
into the text field and click OK.
- Expand the Empty node and select the SHOWMESSAGE node. In the property sheet
on the right side of the dialog box, select the Exec property and type:
cmd.exe /x /c "echo ${MESSAGE}"
- To view the result of the command in the Output window, set the Print Command
Output property of the SHOWMESSAGE command to True.
- Click OK to close the command editor. Then click Finish to close the New
Generic VCS wizard and mount the filesystem.
- In the Explorer, expand the node for the filesystem you have just mounted.
Right-click one of the files and choose Empty
SHOWMESSAGE from the contextual
menu.
A window appears displaying the command that was issued, which is cmd.exe
/x /c "echo Hello World", and its output, which is Hello
World.
- Unless you plan to further modify the profile for an actual version control
system and work in the files in the filesystem, right-click the filesystem's
root node and choose Unmount Filesystem.
Legal Notices