One of the most popular source code editors, Visual Studio Code, commonly called VS Code, is very beginner-friendly. Its easy-to-use interface and advanced features make it a favorite of both beginner and veteran programmers.
If you’re new to VS Code and looking for a simplified guide on how to run code, you’re in the right place. We’ll guide you through setting up the required software and running code using familiar languages such as C/C++ and Python, as well as how to execute command-line arguments.
The shortcut to run code in VS Code
In VS Code, you only need to use one shortcut to run your code. That shortcut is Ctrl + Alt + N. There are a few more ways to run code.
Pressing F1 and then choosing Run code Also works. If you want to write it after pressing F1you are free to do it too.
Users can right click on the text editor and then select Run code in the context menu. With just two clicks, your code will run.
“Run Code” is also an option in the editor title menu and file explorer context menu.
If you want to stop your code from running, the shortcut is Ctrl+Alt+M. Pressing F1 It also allows you to choose the Stop code execution option. This option is also available in the editor title menu and Output channel.
Lastly, you can right click on the Output channel to open the context menu and select Stop code execution.
Learning these shortcuts and methods should make running and stopping code in various situations a little easier.
How to run C code in VS code
In addition to knowing C code and VS Code, you will need to download the C/C++ extension. Without it, you won’t be able to run C code within VS Code.
These are the instructions to run C code in VS Code:
Configure the required software
- Start VS code.

- Find the C/C++ extension in the extension market.

- Install the extension.

- Download and install MinGW.

- Make sure to install the “Mingw32-base Package” and “Ming32-gcc-g++ Package” options.

- Copy the path to the “bin” folder in MinGW.

- Go to Windows’ advanced system settings.

- Select Environment Variables.

- In it system variables p, click Path.

- Select Edit.

- From here, click New.

- Paste the MinGW path and click OK button.

- Click OK for the other popups.

Encoding in VS code
- Create a folder for your C code.

- Add the folder to VS Code and then hover over the C code folder and click + button.

- Write the name of the file.

- Start coding in C.

- Run the code with Ctrl + Alt + N or any of the other methods mentioned above.

Once you complete the one-time software setup, you will be able to use VS Code and C language easily. Just make sure the other necessary programs are installed correctly before running the code, especially the packages.
How to run Python code in VS code
Running Python code in VS Code is relatively easy. You will need a Python extension and interpreter. The first is found in the VS Code extensions marketplace, but Python interpreters vary depending on how they are installed.
Before installing the others, you should already have Python on your PC. Verifying it beforehand is also essential.
With the preliminaries out of the way, let’s get into the coding process.
- Using a command prompt, create an empty folder and open it.

- Open VS Code in the new empty folder.

- Choose the Python interpreter that VS Code will use.

- Create a Python source file.

- Start coding in Python.

- Run the Python code by clicking “Play” in the top right corner of your editor.

Which interpreter you install depends on your needs, but VS Code works incredibly well with Python regardless of your choice of interpreter.
How to run JS code in VS code
JavaScript works even better in VS Code because the latter already has JavaScript IntelliSense, refactoring, and additional advanced features for the language. Since VS Code works so well with JS Code, little preliminary setup is needed to get up and running right away.
This is how you will run JavaScript code in VS Code:
- Download and install NodeJS on your PC.

- Launch VS Code and create a new folder.

- Write in JS and name the file with the extension .js.

- Save the changes.

- Open a VS Code terminal.

- Guy “
cd yourdirectoryname” to navigate to the JavaScript code.
- If you want to check the output of your code, type “
node yourfilename” and wait.
Your directory and files will have different names, so we just include them as placeholder names.
There is also an easier way to run JavaScript code:
- Install code runner.

- Write or open a JavaScript code file.

- Run the code with Ctrl + Alt + N or any other method.

- The output window will show your code.

If you just want to test a few lines of code and then save them, this method shines. You can finish in a minute and have a file ready to store for future use.
How to run code with arguments in VS code
Command line arguments are for debugging or launching code files, and VS Code fully supports this type of code and debugging. In this p, you will learn how to run code with arguments.
Before doing so, you need to get “launch.json”. If you don’t have it, you can create it by following these steps:
- Gonna Run.

- Select Add configuration.

The following steps are to execute code with arguments:
- Open launch.json and add your arguments.

- Select the file to debug.

- Click Run and debug to debug your code.

These are the basics of running your code with arguments. In this case, we are talking about Python since it is the simplest example.
Simplified coding
With this knowledge, running code in VS Code should become as natural as breathing, with enough practice. The various languages you can use with VS Code make it a powerful and easy-to-use IDE. As such, many developers highly recommend that aspiring programmers learn how to use it.
Do you like using VS Code? What do you think of the interface? Let us know your opinion in the comments p below.