Build C++ in Powershell not CMD with Sublime Text 3

Viewed 433

I'm wondering if there is a way to run builds in Sublime Text 3 so that it outputs in Powershell and not CMD.

{
    "cmd": ["gcc", "${file}", "-o", "${file_base_name}.exe"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",
    "shell": true,

    "variants":
    [
        {
            "name": "Run",
            "cmd": ["start", "cmd", "/k", "${file_path}/${file_base_name}.exe"],
            "shell": true
        }
    ]
}

This is the code I found online that will use MinGW as the compiler and allow you to press Ctrl + B to build a C++ program in ST3. When you do this the output goes to the CMD prompt. Is there a way to make the output go to Powershell instead?

1 Answers

This will work for sure.

    {
    "cmd": ["gcc", "${file}", "-o", "${file_base_name}.exe"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",
    "shell": true,

    "variants":
    [
        {
            "name": "Run",
            "cmd": ["start", "powershell", "-NoExit", "${file_path}//${file_base_name}.exe"],
            "shell": true
        }
    ]
}
Related