Shell command

From m204wiki
Revision as of 18:43, 9 February 2023 by Ekern (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Runs a command/program under the Windows command shell, or opens a DOS/command prompt box.


shell {&var|'string1'|"string2"|&&function} ... 


  • string1 and string2 are single or double quoted string literals.
  • &&function is an invocation of a Debugger Client &&function.

The command to execute is created by concatenating all the arguments together into a string.  Blanks are placed between the argument values when they are concatenated.  If a command/program is specified (possibly with arguments) it is run.  If none is specified, a DOS box is opened (its current directory will initially be in the Debugger Client install directory).

Shell permits you to run programs and DOS commands or to open a DOS box from within the debugger.  This includes from the debugger command line or a debugger macro, or mapped to a UI button or key.

If you have a collection of programs or scripts you wish to run from the debugger, it might be useful to collect them in one directory, and then specify that location in the configuration using the <scriptFolder> tags.  You can then access the script folder using the &&scriptFolder function.

Client menu:
Introduced: Build 69

Here is an example macro that uses the shell command to run a python program:

# run which shows the end of the debugger client log  # (like the *nix tail command). openMacroConsole   # set up &pythonProgram and &pythonOutput include pythonSetup tail   # run the program (assumes python command is available and python 3) shell "python" &pythonProgram &&quote(&&logFile) '>' &pythonOutput   # Display the output of the program editFile &pythonOutput   This macro includes # Given the name of a python program (without .py) passed as an argument,  # set up two macro variables: #     &pythonProgram: full fileSpec of program, assuming it's in the scriptFolder #     &pythonOutput: a file to which to send the program, in the output # # Both values are quoted so they can be passed to the DOS shell, even  # if the file paths # contain blanks. set &pythonProgram = &&quote(&&concatenate(&&scriptFolder, &&arg(1), '.py')) set &pythonOutput = &&quote(&&concatenate(&&stateFileFolder, &&arg(1), "Output.txt"))