Epi Info™ User Guide

Command Reference


Check Commands: Execute

Description
Executes a Windows or DOS program – either one explicitly named in the command or one designated within the Windows registry as appropriate for a document with a named file extension. This provides a mechanism for bringing up the default word processor or browser on a computer without first knowing its name. The EXECUTE command accepts a series of paths, separated by semicolons:

EXECUTE c:epi_infomyfile.exe;d:myfile.exe

If the first is not found, the others are tried in succession. In Check Code, the EXECUTE command can be placed in any command block, but is often used with a button. A button does not have a Before Entry section.

Syntax

EXECUTE <filename>

EXECUTE “<filename> <command-line parameters>”

EXECUTE NOWAITFOREXIT <filename>

EXECUTE NOWAITFOREXIT ‘<filename>’

EXECUTE NOWAITFOREXIT “<filename>”

EXECUTE WAITFOREXIT <filename>

EXECUTE WAITFOREXIT ‘<filename>’

EXECUTE WAITFOREXIT “<filename>”

  • The <filename> represents the path and program name for .exe (filename for registered Windows programs) and .com (filename for MS-DOS binary executable) files.
  • The <command-line parameters> represent any additional command-line arguments that the program can accept.
  • When Wait for Command to Execute (modal) is specified, the command should run and Enter should continue running. When Wait for Command to Execute is not specified (non-modal), Enter should wait until the executed program closes before continuing. When EXECUTE is run modally, permanent variables are written before the command is executed and reloaded after it is executed.

Comments
If the name of an executable program, (e.g., ENTER.EXE, MYBATCH.BAT, or MYWEB.HTM) is given, the program will be run in a separate window. The window closes when the program terminates.

If the name given is a file type associated with a default app in the Windows settings, the associated program will open the specified file.  For excmple, WRITEUP.DOCX might cause Microsoft Word© to run and load the file named WRITEUP.DOCX.  A file ending with .HTM or .HTML will likely open using the the default browser.

If the app is a registered Windows app, you will not need to supply the location or the program name that will be run. These details are stored in the Windows registry for common file extensions.  The same concept applies to Internet addresses (URLs). Give a URL (Universal Resource Locator) that ends in .HTM or begins with HTTP:// “https://www.cdc.gov/epiinfo/” and Windows brings up the default browser, connects to the Internet (if possible), and goes directly to the site indicated.

Examples
Example 1: A text file on the C drive is opened with the default text editor.

EXECUTE  “C:\logfile.txt”

Example 2: An executable program is run.

EXECUTE "C:\Windows\Notepad.exe"

Example 3:  The default web browser is run and passed https://www.cdc.gov/epiinfo as a command-line parameter.  Because WAITFOREXIT is specified, Enter will not allow you to continue entering data until the browser window is closed.

EXECUTE WAITFOREXIT "https://www.cdc.gov/epiinfo"
Page last reviewed: September 16, 2022, 12:00 pm