Do you know any tool that allows you to store command lines and easy execute them (maybe even supporting parameters)? Something like:
c:\foo\bar\baz.exe --foo [play] c:\foo\bar\qux.exe --bzz [play]
It can also be a VSCode extension.
For regular Windows cmd, use clink. It has command history that you can configure.
History features include but aren't limited to:
When the
history.save
setting is enabled, then the command history is loaded and saved as follows (or when the setting is disabled, then it isn't saved between sessions).Every time a new input line starts, Clink reloads the master history list and prunes it not to exceed the history.max_lines setting.
When the history.shared setting is enabled, then all instances of Clink update the master history file and reload it every time a new input line starts. This gives the effect that all instances of Clink share the same history -- a command entered in one instance will appear in other instances' history the next time they start an input line.
History items can optionally save the timestamp when they were added, and the timestamps can be shown in the
history
command.
Clink can suggest commands as you type, based on command history and completions.
To turn on automatic suggestions, run
clink set autosuggest.enable true
. When the cursor is at the end of the input line, a suggestion may appear in a muted color. If the suggestion isn't what you want, just ignore it. Or accept the whole suggestion with the Right arrow or End key, accept the next word of the suggestion with Ctrl + Right, or accept the next full word of the suggestion up to a space with Shift + Right.
I've accidentally found a nice workaround.
Create a ps1
file and open it with VSCode
. Then type in your commands and add | Invoke-Expression
after each of them at the end of the same line like this:
"C:\foo\bar\baz.exe --foo --bar" | Invoke-Expression
In order to execute it, just select the entire line and press F8! Isn't that awsome?!
It's also possible to use variables and the good news is that you can initialize the variables first (select the line(s) + F8) and later run other lines independently in any order!
$baz="C:\foo\bar\baz.exe" # <-- select and hit F8
"$baz --foo --bar" | Invoke-Expression # <-- select and hit F8 later!
There's more one can do (Three Ways To Run .Exe Files In PowerShell), but the examples here cover the most basic and common usage.
batch_file param
. Then compare the param to decide which command to execute inside the batch file. I would give you an example, but I wanted to know why you were discounting this approach, first.