Variable Syntax and Usage

Variables are called using SH syntax, which is 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 Windows NT/2000 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 echo command. No files on your system will be changed by following this example.

To see a simple example of variable usage:

  1. Open the New Generic VCS wizard by choosing Versioning and choosing Mount Version Control and choosing Generic VCS.
  2. In the Version Control System Profile combo box, choose Empty (yourOS).
  3. If you wish, browse to a directory in the Working Directory field. For the purposes of this example, you can leave it at the default. No files will be changed by following this example.
  4. Click Next to advance to the Advanced panel of the wizard. Click the Edit Variables button to open the Variable Editor dialog box.
  5. Right-click the Accessory node and choose New Variable from the contextual menu. Type MESSAGE in the text field and click OK.
  6. Expand the Accessory node and select the MESSAGE node that you just created.
  7. In the property sheet on the right side of the dialog box, select the Value property and type:
    Hello World
  8. Click OK to close the Variable Editor and then click Edit Commands.
  9. Right-click the Empty node and choose Add and choose 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.
  10. 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:
  11. cmd.exe /x /c "echo ${MESSAGE}"
  12. In order to view the result of the command in the Output window, set the Print Command Output property of the SHOWMESSAGE command to True.
  13. Click OK to close the Command Editor and click Finish to close the New Generic VCS wizard and mount the filesystem.
  14. In the Explorer, expand the node for the filesystem you have just mounted. Right-click one of the files and choose Empty and choose SHOWMESSAGE from the contextual menu.

    A window should open displaying the command that was issued, which is cmd.exe /x /c "echo Hello World", and its output, which is Hello World.

  15. 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.
See also
Variables in VCS Commands
Creating a New Variable
Runtime Variables
Creating a Custom VCS Profile
Substitution Formats for Variables

Legal Notices