.vscode/tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "my_cmd",
"type": "shell",
"windows": {
"command": "cmd.exe /C 'D:/dev/tool/vs2019/IDE/Common7/Tools/VsDevCmd.bat && cl.exe /std:c++latest ${fileBasename} /Fe:${fileBasenameNoExtension} && ${fileBasenameNoExtension}.exe '"
}
},
{
"label": "my_shell",
"type": "shell",
"windows": {
"command": "powershell.exe -Command "&{Import-Module """D:/dev/tool/vs2019/IDE/Common7/Tools/Microsoft.VisualStudio.DevShell.dll"""; Enter-VsDevShell b4b5a7e6; cd ${fileWorkspaceFolder}; cl.exe /std:c++latest /Fe:${fileBasenameNoExtension} ${fileBasename}}; ./${fileBasenameNoExtension}.exe ""
}
},
]
}