-
Notifications
You must be signed in to change notification settings - Fork 39
Commands
Commands allows a specified command to execute when a file or folder in a watch path is changed. The commands are specified within the <commands> element that is a child of the <watch> element.
A watch can contain execute multiple commands for a change. Each command is specified within a <command> element within the <commands> element.
Warning: Be careful when running commands. The commands will run under the context of the user that is running FileWatcher. If the System or administrator user is running FileWatcher, than any commands will run under the System or administrator context.
<watches>
<watch>
<commands>
<command>
<triggers>
<trigger></trigger>
</triggers>
<path></path>
<arguments></arguments>
</command>
</commands>
</watch>
</watches>The following elements are used to specify the command to execute:
| Element | Description |
|---|---|
| triggers | The triggers for the notification. For more information, see Triggers. |
| path | The full path of the file to execute. Can include Path Placeholders. |
| arguments | Arguments to pass into the command. Can include Path Placeholders. |
Information about the valid triggers, can be found on the Triggers page.
The full path to the file to execute is specified using the <path> element. The path value specified can use Path Placeholders to provide dynamic path.
Arguments to pass into the execute file are specified using the <arguments> element. This is a string value of all the arguments, so they are not separated by separate child elements within this element. The arguments can use Path Placeholders to provide dynamic paths for arguments that need such information.
Call an executable C:\Tools\fv\fv.exe with the arguments -f [exactpath] when a file is created in C:\Temp. If the file created is C:\Temp\test.doc, then the command that is run is C:\Tools\fv\fv.exe -f "C:\Temp\test.doc"
<watches>
<watch>
<path>C:\Temp</path>
<commands>
<command>
<triggers>
<trigger>Create</trigger>
</triggers>
<path>C:\Tools\fv\fv.exe</path>
<arguments>-f "[exactpath]"</arguments>
</command>
</commands>
</watch>
</watches>