'Redirect error messages to a file in sublime text

Reference image


Is it possible to redirect the message in the shell to a file say error.txt. I use the following build system

{
    "cmd": ["g++.exe","-std=c++17", "${file}", "-o", "${file_base_name}.exe", "&&" , "${file_base_name}.exe<input.txt>output.txt2>error.txt"],
    "selector": "source.cpp",
    "shell": true,
    "working_dir": "$file_path"
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source