🌐
Reddit
reddit.com › r/learnprogramming › how do i run code through the terminal in vscode?
r/learnprogramming on Reddit: How do I run code through the terminal in VSCode?
November 21, 2023 -

I’m trying to follow along to the CS50 YouTube video, and I’m stuck on one part (Week 1 - C) that requires VSCode. I downloaded it and put the code in, but the dollar sign as shown in the video was not in my terminal. And when I tried running the code, I kept getting the error message “The term is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.” I looked through settings and YouTube videos but they didn’t help or were too confusing. How do I fix this?

🌐
Reddit
reddit.com › r/vscode › how to run code?
r/vscode on Reddit: How to run code?
November 25, 2023 -

Hi, I'm a complete moron newbie to programming and don't know how anything works, was just wondering if there's any way to get vscode to just... run stuff? I started off with the full-on visual studio and started rewriting some basic stuff in C++ and everything just works right out of the box. I press CTRL + f5 and the code is compiled just fine. Not so with vscode for some reason.

🌐
Reddit
reddit.com › r/vscode › how should i run code in visualstudiocode?
r/vscode on Reddit: How should i run code in VisualStudioCode?
March 13, 2024 -

Hello people i have been using VSC for 4 years. I always ran my code by pressing the play button, then the code was executed here https://gyazo.com/7073ec281996c36f8acdb690db1bc500
and it always allowed interaction with the user.

For exaple if i put in the coding zone this: string= input("insert a string) i could insert a string and the code will track the variable, and the code will continue be running. But i can't interact with the program anymore.

Running the program in the terminal gives me 2 issues:

1: I have to write everytime the name of the file(main.py) to execute it instead of pressing the play button.
2: I can't stop the execution by pressing stop. So i have to restart VisualStudioCode to kill the execution of the program.

So my question is: There is a 3rd choice? Is there somethiong i can install to properly execute .py files?
Thanks for advance

🌐
Reddit
reddit.com › r/vscode › is there a way to run code in terminal not integrated to the software?
r/vscode on Reddit: Is there a way to run code in terminal not integrated to the software?
April 9, 2025 -

Hi beginner programmer here!

I've been really wanting to modify my vs code for quite a while now to run a code in terminal in another window just like when running code in DevC/C++ software.

I kept searching on youtube on how to do it but it always kept showing the same thing how to run code in terminal (integrated to the software), is there a way to modify vs code for this purpose it' just preferably better to run programs on another window imo.

🌐
Reddit
reddit.com › r/vscode › how do i compile and run?
r/vscode on Reddit: How do I compile and run?
September 4, 2024 -

I’ve been programming for years now, in multiple languages. I’ve never used an IDE or anything like vs code. I usually just use a text editor and a terminal to do all my coding.

This whole process is starting to get annoying so I downloaded vs code but I cannot get anything to work. I don’t know what I am doing. According to the tutorials, I should be able to press the debug and run button and vs code will compile and run my code, but I can’t get this to work. It’s saying I need a configuration, or that blah blah blah.

So far, I’ve only been able to get python to work. So my questions are: what is a configuration? Why do I need one? How do I get c++ to work with the push of one button?

🌐
Reddit
reddit.com › r/vscode › how to run code in an external terminal?
r/vscode on Reddit: How to run code in an External Terminal?
February 12, 2022 -

I just recently downloaded VsCode and am now under severe shock because of how different this IDE is than Visual Studio. So, One thing that really ticks me off is the integrated terminal. I tried editing settings.json to "terminal.external.windowsExec": "C:\\WINDOWS\\system32\\cmd.exe",

and I tried changing the user settings' Terminal to "external" and I still can't figure out why my source code won't run in an external Terminal. I really want to like VsCode, but stuff like this Is really infuriating.

🌐
Reddit
reddit.com › r/vscode › run vs from terminal and run command inside vs terminal
r/vscode on Reddit: Run VS from terminal and run command inside VS terminal
December 29, 2020 -

Hey guys I have this problem i`m trying to solve,
I have a project I run in VS code, but I run couple of different apps with npm run or docker so I have this script that runs all the apps inside terminal and open VS-code for every app I am building.
So what script basically do is I have these commands that open new tab in guake and execute different script inside each terminal tab and runs code along. So what I would like to do is to have this run inside VS-code terminal.

I hope you guys get what I`m trying to achieve.. :)

Thanks in advance

Find elsewhere
Top answer
1 of 7
2
I think you are talking about the code to become run in an external terminal. The terminal/shell included in the lower part of VS Code is allready a "command promt". Shells are promt-based interfaces used to communicate with your OS. The best and most popular ones are Bash and Powershell. The Command Promt or CMD you have in Windows is the default one. Just treat them as different programs used to communicate with your PC and run code without an interface. Now to your question. While building, compiling and running your code within VSCode you make use of different .json scripts stored in a .vscode folder inside your project. After installing, lets say MingW and using the build button inside VSCode the respective .json files are automatically created for you. The launch.json is the one where a parameter called "console" can be feed with the argument "externalTerminal" if i remember correctly. I strongly urge you to ask chatGPT about this. It will after you give it your current .json files complete it with the necessary parameters. I'm unfortunately not on my computer right now so I am too lazy to give you the exact info. Have fun with further coding.
2 of 7
2
IT WORKS JUST FINE! Thanks for the advice u/SalomonBrando These are the steps on how I configured Visual Studio Code (VSCode) to execute C++ code in an external terminal, such as the command prompt. Step 1: Install and Configure the C++ Compiler First, install and set up the C++ compiler in Visual Studio Code by following this video tutorial: link to the video . Make sure to follow the steps provided in the video. Step 2: Configure the "Code Runner" Extension Open Visual Studio Code and go to File > Preferences > Settings. In the settings, search for "Run Code Configuration." Find the "Code-runner: Executor Map" setting and click on "Edit in settings.json. Step 3: Update the Configuration Remove the existing "cpp" configuration if it's present to avoid duplications. Copy and paste the following code: "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && start cmd /K \"$fileNameWithoutExt\"", paste the code under: { "code-runner.executorMap": { Save the settings. Step 4: Run Your C++ Code Now that you've configured "Code Runner" for C++, try running your C++ code in Visual Studio Code. You'll see the output in your Command Prompt. Happy coding!
Top answer
1 of 3
21
You are very new. It's all good, we've all been there. Terminals Shells can run any program that they see in your system Path. Path is a variable that your operating system stores and can access any time. This variable tells your shell where to look for shell programs. Python is a program that interprets Python's any_file_name_here.py files and can run them from the shell. Your shell window is currently trying to run a program called wordies[0]. That is obviously nonsense. If you run the command Python your_python_file.py it will start your Python interpreter (the Python program that the shell finds in your OS Path), and that Python interpreter program will execute the code in your python file provided that there are no errors. You want to set up your local VSCode to have a Python extension. VSCode probably already has it. Once it does, when you hit shift+enter, it'll just automatically run whatever Python file is open in VSCode until the script finishes running or you press ctrl+c (polite to the computer keyboard interruption command) or ctrl+/ (rude to the computer immediately stop command). This is the easiest way to get up and running without learning too much about what is happening under the hood. Once you're more comfortable, I strongly recommend doing a deep dive on shells/interpreters/terminals. The biggest things to know are that in any terminal session, there are a few critical things. Chiefly, the user, current working directory and which command/program is running. Understand that terminal windows can access the files located in the directory listed at the beginning of the new line (in addition to what's in path). In your case, this directory is C:\Users\ttom\Desktop\Python\. I cannot tell if this ...\Desktop\Python\ directory is where you inadvertently installed your Python interpreter or a directory full of custom code you're trying to run (or god forbid both, definitely don't do that). Do not work out of a file named Python while learning Python and terminals at the same time unless you really like being confused. The terminal outputs will be useless when there are errors, and there will be errors. Terminals are generally really nice about telling you what errors happened if you let them be. Rename that directory to anything else if it's just full of custom code. If that file contains your Python installation instead and is not a directory full of your own custom code files, then wipe it and reinstall the Python installation somewhere normal. Just follow literally any tutorial you can find and make sure you've added Python to Path. It's worth noting that VSCode does not care if Python is in Path or not if you're just running with shift+enter. You can skip the last 2 paragraphs of my comment if you want. All you need to do is get shift+enter to work and you can get started without knowing hardly anything about shells. I just wrote this up for your benefit. Some closing quality of life bullshit: Tapping the up arrow key will cycle through the history of recent shell commands. For reasons you do not want to know, You can't paste with ctrl+v in shells, you need to use ctrl+ins or click with a mousewheel if you've got one. This is a weird but good thing for reasons you don't want to know now. If you press tab while typing a file/directory name, it will auto-complete the name if it knows you're typing a file name and you've typed enough characters that it isn't confused about which file you're trying to access. You can run a command clear to erase all terminal output if your screen is too cluttered. Homework: at least learn how navigate around and add or remove files/directories. If you get that far, you should pick up enough knowledge to have a fighting chance of comfortably troubleshooting without too much outside help.
2 of 3
1
What is wordies?
🌐
Reddit
reddit.com › r/learnprogramming › how to efficiently run code in integrated terminal in visual studio code?
r/learnprogramming on Reddit: How to efficiently run code in integrated terminal in Visual Studio Code?
November 13, 2022 -

I'm SSHing into a remote server. I'm writing my code in Visual Studio Code. I can run the code on the remote server in the integrated terminal, but that requires me to copy and paste the code into the integrated terminal. Is there some shortcut that will allow me to send my code to the integrated terminal?

🌐
Reddit
reddit.com › r/learnprogramming › how to operate visual studio code
r/learnprogramming on Reddit: How to operate Visual studio code
October 2, 2023 -

Hi. I am new to coding and i want to start my coding journey on visual studio code, the reason is, my friends said that you can use most if not, all the languages in one platform, so i find it very useful and less hassle. But the thing is, i do not know how to operate visual studio code. I tried to understand vsc but i got overwhelmed as i launched the platform for the first time and it threw a lot of information that i dont udnerstand, for example: downlaoding extensions and stuff.... do you guys can shower me some of advice onn what to do as a beginner.. thank you for those who wil respond...

Top answer
1 of 5
4
You'd likely need to find a plugin for the language you're wanting to write in. From my experience with VSCode, it supports many languages by supporting plugins that do all the work. If you want to write Python, you'd install a Python plugin to get the autocomplete and other Python-specific stuff. You'll also need to install the interpreter/compiler needed for the language if the plugin doesn't include that. It would help if you described what exactly you need help with.
2 of 5
4
I recently started learning programming Step 1. Download the programming languages to you're computer ensuring the Bin .exe files are in your PATH system environmental variable. E.g. Mingw64 for C++ or Python for Python. Step 2. Download VS Code Step 3. Download the extensions for the languages you want to high light errors/have a linter. E.g. C++ extension, Python extension, JavaScript extension. If you don't know what extension you have or need create a new .cpp, .js or .py file and type a simple hello world. If you cannot see errors your extensions/linters are not installed. Step 4. After just click build (for compiled languages If you have issues it will auto create a tasks.json file in the args section enter any linkers or libraries for compiled languages) or Run if a interpreted language e.g. Python. Note that the terminal at the bottom (CTRL + SHIFT + Tilde ~) uses your Windows PowerShell Step 5. Make a folder put your code in that, and your images folder, sound folder, libraries folder, etc., and you can open the folder in VSCode, right click and create a "Workspace" file. Then move that to your desktop or anywhere. In the future run your "workspace" file and it opens up the folder/project.
🌐
Reddit
reddit.com › r/vscode › run code in a window within visual studio code
r/vscode on Reddit: run code in a window within visual studio code
June 3, 2023 -

not really new to programming - have been using notepad++ to write code and run code from the command line (mostly python, bash and windows batch)
have seen that many are using visual studio code and it looks like it is running the code in a window within visual studio code but when i run code it opens a new 'command' window, is it possible to have a window within visual studio code am i not seeing what they are running correctly
have been searching but dont seem to find anything

🌐
Reddit
reddit.com › r/learnpython › on the vs code ide, is there a keyboard shortcut to run the code in a python terminal?
r/learnpython on Reddit: On the VS Code IDE, is there a Keyboard shortcut to run the code in a python terminal?
May 3, 2024 -

Hi everyone, so I am a little frustrated and annoyed because I am using the "Ctrl+alt+N" shortcut and it runs in an output terminal. But for some reason, my code isnt allowing me to input via keyboard for the code in this terminal. I need to run in the Python Terminal (manually clicking the "Run in Python Terminal" icon). I wish i could submit an image, but this community doesnt look like it allows that.

Is there a way to set keyboard shortcuts to these types of commands? It would make my life so much easier.

For example, on Matlab, we have the F5 keyboard shortcut to run the code without clicking the icon each time.

🌐
Reddit
reddit.com › r/learnpython › what is the keyboard shortcut in vs code to run a python file?
r/learnpython on Reddit: What is the keyboard shortcut in VS Code to run a python file?
August 9, 2021 -

Dumbest of dumb questions but I'm new to this, and have never used VS Code before.

I've written a basic python file that I can run just fine by pressing the triangle in the upper right hand corner in VS Code.

However, for the life of me, I cannot figure out how to run the same file via a keyboard shortcut.

Shift Enter seems to only run whatever text is selected. F5 runs the file, but leaves me in a debug mode.

I'm probably missing something glaringly obvious, but how do I run the whole file via a shortcut..?

🌐
Reddit
reddit.com › r/vscode › how do i run lines in the terminal, not the repl?
r/vscode on Reddit: How do I run lines in the terminal, not the REPL?
October 21, 2024 - You can run python directly from the terminal without using VSCode options. ... If you write just "python" you should be able to write and run individual lines in the terminal.