My intention is
- to make code run in external terminal
- to pause that terminal so I can see the result.
Original code-runner setting which runs code in the integrated terminal was
"code-runner.executorMap":{
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
...
}
I've managed to make codes run in external terminal using this code:
"code-runner.executorMap":{
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && start $fileNameWithoutExt.exe",
...
}
But the terminal disappears so quickly that I can't see the result.
I've tried the fourth answer on the link above:
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && Start pwsh -Command \"& {.\\$fileNameWithoutExt.exe; pause}\"",
but it doesn't work for me as vscode says: A parameter cannot be found that matches parameter name 'Command'.
I also tried
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && start $fileNameWithoutExt.exe && pause",
but external terminal still disappears and "pause" makes integrated terminal to pause.
Then I tried
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && start cmd /k $fileNameWithoutExt.exe"
I thought "start cmd" opens new command prompt and "/k" would let it continue.
(https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cmd)
It still doesn't work and vscode says: A positional parameter cannot be found that accepts argument hw3.exe
. (hw3 is the name of my file)
I know there is code-runner:run
in terminal- whether to run code in integrated terminal setting in Files>Preferences>Settings>User
but there are several folders in my workspace and I intend to run code in external terminal for this specific folder only. So I keep that setting checked and working with settings.json which is unique to this folder.
Thanks for your time and stay safe!!