HydroCAD Stormwater Modeling - Since 1986


HydroCAD Command-Line Options

Projects are normally opened by using the Project|Open command on the HydroCAD main menu.  You can also select a project file directly in Windows, which causes HydroCAD to launch and open the specified file.

For special applications, you can also invoke HydroCAD using the Windows command line.  Special command-line options are also available to automatically add, merge, or calculate a project.  These can be used in a batch file to automate a specific process, or by another program that needs to interact with HydroCAD.  You can also create a windows shortcut to perform a specific sequence of operations that is used repeatedly.

Basic Commands

Starting HydroCAD

To launch HydroCAD from a command line, specify the program location and name, such as:

    "C:\Program Files\HydroCAD\HydroCAD.exe"

Quotes are required if the file name contains separators, such as spaces.  Be sure to specify the actual folder in which HydroCAD is installed.  Although most installations will use the default folder shown in this example, the user may have selected a different drive or folder at the time of installation.  The actual installation folder can be determined by reading the following registry key:

    HKEY_LOCAL_MACHINE\Software\HydroCAD\InstallDir1

Opening a Project

To open a specific file in HydroCAD, add the file name to the HydroCAD command shown above:

    "C:\Program Files\HydroCAD\HydroCAD.exe"  "c:\MyFolder\MyProject"

  1. If the project path is not specified, HydroCAD will use the most recent project path.  For repeatable results, the actual path should always be specified.
  2. If HydroCAD is already running, commands are always directed to the current instance of HydroCAD, rather than launching a second instance.
  3. If HydroCAD already has another project open, the specified file is opened on a new project tab without disturbing the previous project.
  4. If the specified file is already open in HydroCAD, HydroCAD displays the corresponding project tab, along with a message that the "file is already open".
  5. If the file does not exist, an empty project is automatically created using the default project settings.

To open multiple files, you can execute an additional command line for each file.  Or you can include multiple file names on a single command line.  Each project will be opened on a separate tab and the last project will be selected:

    "C:\Program Files\HydroCAD\HydroCAD.exe"  "c:\MyFolder\MyProject"   "c:\AnotherFolder\AnotherProject"

Command-Line Switches

Switches are used to automate specific operations that would normally be executed by the user with the mouse or keyboard.  They are generally used in combination with a basic command line, as discussed above.  For example, to open a project and then close it, you could add the "Close" switch:

    "C:\Program Files\HydroCAD\HydroCAD.exe"  "c:\MyFolder\MyProject"  /C

Although this might seem to be an unproductive command, if the auto-export options have been selected within the project file, they will be executed when the file is closed.  This can be used to trigger the calculation and export of data for use by another program.  See the Settings|Export screen for details.

Basic Commands

The following command-line switches were implemented in HydroCAD 9.0, and are not available in earlier versions.  Update details here.

{space}/C = Close the current project.  This is the same as the Project|Close command.  If the project has been modified, the user is asked for permission to overwrite the existing file.  If the Silent switch is specified, the file is overwritten without prompting.

Note: This switch must be preceded by a space to separate it from the previous parameter.

{space}/E = Exit from HydroCAD.  This is the same at the Project|Exit command.  If a project has been modified, the user is prompted to save the file.  If the silent switch is specified, each file is overwritten without prompting.

Notes:  This switch must be preceded by a space to separate it from the previous parameter.  If HydroCAD is already running when the current command line is issued, the Exit command is ignored.  This allows a pre-existing instance of HydroCAD to keep running without interruption.  For this reason, you should always use the /C option to ensure that a project is saved and closed, rather they rely on /E alone.

{FileName}/A = Add the contents of the specified project to the current project.  This is the same as the Project|Add command.

Notes:  The switch must immediately follow the file name without an intervening space.  In most cases you should also open the base file immediately before the file to be added.  For example:

        "C:\Program Files\HydroCAD\HydroCAD.exe"  "c:\MyFolder\BaseFile"   "c:\AnotherFolder\AddFile"/A

{FileName}/M = Merge the contents of the specified project into the current project.  This is the same as the HydroCAD Project|Merge command.

Note:  The switch must immediately follow the file name without an intervening space.  In most cases you should also open the base file immediately before the file to be added.  For example:

        "C:\Program Files\HydroCAD\HydroCAD.exe"  "c:\MyFolder\BaseFile"   "c:\AnotherFolder\MergeFile"/M

{space}/S = Silent mode.  Prevents the prompts that might normally occur during the execution of the above commands.  If a project has been modified, the previous file is automatically overwritten.  When feasible, default file names are used instead of prompting for input.  Since the silent command applies only to subsequent commands on the same line, it is generally placed at the beginning of the line, as shown below in the multi-option example.

Import/Export Commands

The following commands were added in HydroCAD 10.0 and provide advanced capabilities for import and export of watershed data.

{FileName}/XA = Export Subarea data for the current project to the specified file.  This is equivalent to the Export|Subareas command.

{FileName}/XF = Export Flow Segments for the current project to the specified file. This is equivalent to the Export|Flow Segments command.

{space}/XS = Export Subcatchment data for the current project to default files.  This is equivalent  using the /XA and /XF switches at the same time, or to the Export|Subcatchment command.

{FileName}/IA = Import Subarea data into the current project from the specified file.  This is equivalent to the Import|Subareas command.

{FileName}/IF = Import Flow Segments into the current project from the specified file.  This is equivalent to the Import|Flow Segments command.

{space}/IS = Import Subcatchment data into the current project from default files.  This is equivalent to  using the /IA and /IF switches at the same time, or to the Import|Subcatchment command.

{space}/IW = Import Watershed data according to the options on the Settings|Watershed screen.  This is equivalent to the Import|Watershed command.

Note: For all import/export commands listed above, if the specified file has no extension, HydroCAD adds a .CSV extension. If a folder is not specified, HydroCAD places the file in the same folder as the project. If no file is specified, HydroCAD uses a default filename, which is verified with the user unless the silent option is also specified.

Using multiple options

To perform more complex operations, you can combine multiple command line option.  This example will open a base file, merge updated information from a second file, save the updated file (performing any auto-export), and exit from HydroCAD, all without any user prompting:

        "C:\Program Files\HydroCAD\HydroCAD.exe"  /S  "c:\MyFolder\BaseFile"  "c:\AnotherFolder\MergeFile"/M  /C  /E

 

For additional details, read about HydroCAD startup.

 

[Home]   [Support] 
Copyright 2015 HydroCAD Software Solutions LLC (privacy)   (legal notices)