This worked for me:
It works with paths and files with whitespaces
by spilting up the arguments with "arg" ,
such as:
[..., "/C", "START", "${file_path}", "${file_name}"]
Paste this into your Batch.sublime-build
file.
{
"file_patterns": ["*.bat"],
"selector": "source.Batch",
// This runs the batch file in cmds' console
"cmd": ["cmd", "/C", "START", "${file_path}", "${file_name}"]
}
Your batch file can then be run in the CMDs' CLI. I suppose it's possible to pass arguments also but this may be a starting point for you.
The above will run cmd.exe and run the code in its native console. This will accept your inputs of the .bat file.
Here's a build that can be saved as BatchStConsole.sublime-build
{
"file_patterns": ["*.bat"],
"selector": "source.Batch",
// This outputs to Sublime Texts' console
"cmd": ["cmd", "/C", "${file}"]
}
The above will run the code in Sublime Texts' console. This will not accept your inputs of the .bat file. But still useful for debugging as it passes any arguments like the native CLI but just no interaction.
Relevant help:
START
https://ss64.com/nt/start.html
https://docs.sublimetext.io/guide/usage/build-systems.html
https://www.sublimetext.com/docs/3/build_systems.html