You can use the extension multi-command to type the batch file command to the terminal
Add this to your settings.json
:
"multiCommand.commands": [
{
"command": "multiCommand.callPrincipal",
"sequence": [
{ "command": "workbench.action.terminal.sendSequence",
"args": { "text": "principle.bat\u000D" }
}
]
},
{
"command": "multiCommand.callTerminate",
"sequence": [
{ "command": "workbench.action.terminal.sendSequence",
"args": { "text": "terminate.bat\u000D" }
}
]
}
]
And then define 2 keybindings in keybindings.json
{
"key": "shift+alt+F1", // or any other key combo
"command": "multiCommand.callPrincipal"
},
{
"key": "shift+alt+F2", // or any other key combo
"command": "multiCommand.callTerminate"
}
You can add when
clauses to limit the validity of the keybinding
Edit
It is not needed to use the multi-command
extension when you only want 1 terminal command, you can define the argument to the keybinding
{
"key": "shift+alt+F1", // or any other key combo
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "principle.bat\u000D" }
},
{
"key": "shift+alt+F2", // or any other key combo
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "terminate.bat\u000D" }
}
Or you can define 2 tasks to start the batch files and run them with Terminal | Run Task....
If you designate one as the build task you can use the shortcut key for that.
I can't find a command that runs a named task, so it can be used in a keybinding.