KeyRoutines
StepProscript.command

Run a command or program from a Windows routine

Run command runs batch commands for cmd, or starts a program with a list of arguments, out of sight. It needs KeyRoutines Pro and is the bridge to command-line tools like git or your own .bat files.

KeyRoutines Pro is a one-time $29.99 upgrade for up to 2 PCs.

How it works

  • Choose to type cmd commands, or to run a program by its full path or a name found on PATH with arguments, one per line.
  • Values from the routine are passed separately and read in commands as !KR_name!, so text such as & or | in a value stays plain text.
  • It runs hidden with a time limit and a memory limit, and everything it started is stopped with it when time runs out.
  • The outputs include the exit code, the output text, error output, the lines, and parsed JSON when the output is JSON.
  • Script steps are off until you turn on Allow script steps under Settings ▸ Advanced, and a dry run skips this step.

Routines that use it

Pull your repos each morning

At a time at 08:45 runs git with pull in your project folder and Script result warns you if it failed.

Run a legacy batch file

A Hotkey runs an old .bat cleanup script and Show banner reports when it finishes.

Network check

When Internet connected or lost fires, Run command runs ipconfig and Write text file saves the output for later.

Settings

SettingWhat it does
ModeType commands for cmd, or run a program with arguments.
CommandsThe commands, as in a .cmd file. Values from the routine aren't pasted in here: add them under Values and use !KR_name! (cmd expands that after reading the line, so the value stays text).
ProgramThe program: its full path, or a name on PATH such as git.
ArgumentsThe program's arguments, one per line. Each is passed on its own, never joined into one command line.
ValuesValues for the commands, by name. The commands read each as !KR_<name>! (for example !KR_folder!).
Working folderThe folder it starts in. Empty: your user folder.
TimeoutIt is stopped, with everything it started, after this long.
Fail on erroradvancedFail the step when it ends with an exit code other than 0.
Memory mbThe most memory it and everything it starts may use together.

Good to know

  • Programs that should keep running after the routine belong in Open app, because a command and everything it starts end with the step.
  • Batch files given as programs refuse arguments with cmd's special characters; pass those as values instead.

Questions

Can I run a .bat file automatically on a schedule?
Yes. Use At a time or Every … with Run command, either as commands or with the .bat file as the program. Turn on Allow script steps in Settings first.
Why are values written as !KR_name! and not pasted in?
Keeping values out of the command text means a value can never turn into an extra command. Cmd reads !KR_name! after it has understood the line, so the value stays plain text.

Pairs well with

Build this routine in KeyRoutines

Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.