Running CMD Commands
The SaveToDB add-in lets you load and refresh data from XML, JSON, HTML, and CSV files.
You can utilize Windows Shell and CMD commands for loading, preparing, or checking these files.
Example Command Configuration
For instance, consider the following configuration:
ID | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | EVENT_NAME | HANDLER_SCHEMA | HANDLER_NAME | HANDLER_TYPE | HANDLER_CODE |
---|---|---|---|---|---|---|---|---|
dbo | files | ContextMenu | dbo | Open {FileName} | CMD | notepad.exe {FileName} |
CMD Handler Format
Use the CMD handler type with commands in the HANDLER_CODE field formatted as follows:
<Command> [<Parameter1>[ <Parameter2>[ ...]]
You can include context values in these formats: {ParameterName=DefaultValue}
or simply {ParameterName}
.
Command Examples
Here are some command examples:
{FileName} notepad.exe {FileName} dir . cmd /c dir {Mask=*.*} cmd /k dir {Mask=*.*} sayhello.cmd {FirstName} mailto:{Email}&subject=Thanks for the connection&body=Hello {FirstName},%0A
The last example demonstrates how to launch a new email using the mailto: command. Note that mailto: handlers are added to menus only for non-empty recipients.
Execution Modes
- Use cmd /c to execute a command and close the window afterward.
- Use cmd /k to keep the window open after execution.
The add-in runs commands in the active workbook directory if the workbook has been saved.
Important! Only run commands from trusted sources! The SaveToDB add-in does not validate commands.