The simplest way is to download and install "Build Tools for Visual Studio 2022", which includes the compiler (MSVC) and its command prompt. After that you open the compiler's command prompt and compile your code using the command: cl filename.c This will generate the file: filename.exe You can run it by simply executing: filename That's it! Answer from _mutaz_ on reddit.com
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ cpp โ€บ build โ€บ walkthrough-compile-a-c-program-on-the-command-line
Compile a C Program on the Command Line | Microsoft Learn
Next, verify that the developer command prompt is set up correctly. In the command prompt window, enter cl (or CL, case doesn't matter for the compiler name, but it does matter for compiler options).
๐ŸŒ
Reddit
reddit.com โ€บ r/c_programming โ€บ easiest way to set up c compiler on windows 10 (if you use visual studio code)?
r/C_Programming on Reddit: Easiest way to set up C compiler on Windows 10 (if you use Visual Studio Code)?
March 8, 2023 -

I've been learning C and playing around with it for a couple of months already.

I'm following CS50 course and first half of the course is almost entirely in C.

That being said, I only used their online codespaces so far, - and for my own personal practice, I used online complilers such as https://www.programiz.com/c-programming/online-compiler/

and https://www.onlinegdb.com/online_c_compiler .

This allowed me to focus on coding and not worry about compiling. I've made some stuff already, entirely using these tools.

However, now arrives the time that I need my own compiler on local machine.

The main reason is that I want to start practicing working with files on my own hard disk, and also using libraries outside of what these tools offer, such as conio.h.

I already tried to google how to set-up a compiler in Windows, but I've bumped into many hoops and obstacles and it's not (at least for me) as straightforward as it might seem.

So I'm asking you for help to set up my own coding environment for C in Windows, where I could compile the files (ideally with make too, and not just clang), where I could include external libraries, where I could work with files on my own HDD, etc... And ideally, where I could even turn these files into classical .exe files.

Thanks!

EDIT: Resolved:

Installing Visual Studio 2022 Community with included tools for C++, and then running Developer Command Prompt allowed me to compile C files by using command: cl filename.c which returns exe file, filename.exe . This exe file can be started by simply executing filename in command prompt or even from Windows by simply double clicking on its icon, like any other file. Thanks for all the responses, especially to RidderHaddock and _mutaz_ who gave me best directions.

Discussions

windows - How to compile a C program? - Stack Overflow
I haven't done C in a long time. I'd like to compile this program, but I have no idea how to proceed. It seems like the makefile refers to GCC a lot and I've never used GCC. I just want an executable that will run on windows. More on stackoverflow.com
๐ŸŒ stackoverflow.com
Compiling C-code from the Command Prompt in Windows? - Stack Overflow
I want to compile C code from the Command Prompt in Windows. I have added the environment variable to the PATH and I can compile .cs files with: csc app.cs ... Save this answer. ... Show activity on this post. ... Here's a complete transcript, including setting up the environment for Visual Studio 2005 (change "8" to "9.0" for Visual Studio 2008). CopyC:\src\tests>"\Program ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
gcc - How do I compile a C/C++ program through windows command prompt? - Stack Overflow
Explore Stack Internal ... Im new to the C/C++ programming language an so far have used the Code::blocks program for writing and compiling programs. However I need to know how to compile a program via windows command prompt as I need to access the assembly code created. More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to run C in windows
This is not a language problem, rather an IDE problem. I know VSCode has pretty bad support for C, and Visual Studio is quite massive, so that probably wouldn't work. Code::Blocks is a very lightweight IDE for C and C++, you could try that. More on reddit.com
๐ŸŒ r/C_Programming
22
1
August 19, 2021
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ techtips โ€บ how-to-compile-and-run-c-program-in-terminal
How to Compile and Run C program in Terminal - GeeksforGeeks
December 5, 2025 - Before running C programs, install a compiler that converts C source code into machine code. Visit the official MinGW download page. Download the installer and run it.. In MinGW Installation Manager, select the following packages: ... Go to Installation โ†’ Apply Changes. Wait for MinGW to install all required components. Adding MinGW to the PATH allows you to use gcc from any folder in CMD. Press Windows Key โ†’ search Environment Variables.
๐ŸŒ
Medium
medium.com โ€บ @arpitachawlaakaac โ€บ run-c-and-c-programs-on-windows-in-just-5-easy-steps-98db45bef773
Run C and C++ Programs on Windows in Just 5 Easy Steps! | by Arpita Chawla | Medium
February 1, 2026 - One point that I forgot to mention earlier that gcc is nothing but GNU Compiler Collection and it is used to compile our C and Cpp programs. ... Now, we need to install the MinGW. Open Windows PowerShell and type the following command
๐ŸŒ
University of Auckland
cs.auckland.ac.nz โ€บ ~paul โ€บ C โ€บ Windows
Developing C programs on Windows
Great, now that Visual Studio Community is installed, you have two options for developing and running C programs on Windows. The first option involves using any text editor you like to write your source code, and using the "cl" command within the Developer Command Prompt to compile your code.
๐ŸŒ
Edureka
edureka.co โ€บ blog โ€บ how-to-compile-c-program-in-command-prompt
How to Compile & Run a C Program in Command Prompt?
July 23, 2024 - To compile and run your C program from the terminal without any problems, simply type hello.exe on a regular command prompt in a Windows environment or in a unix-like one, use the command ./hello.exe.
Find elsewhere
๐ŸŒ
Wikihow
wikihow.com โ€บ computers and electronics โ€บ operating systems โ€บ linux โ€บ 3 ways to compile a c program - wikihow
3 Ways to Compile a C Program - wikiHow
March 10, 2025 - If you're using the 64-bit version of Windows, download setup-x86_64.exe. If you have the 32-bit version, download setup-x86.exe. ... Run the installer. Double-click the downloaded file to open the setup wizard. Downloaded files usually save to the Downloads folder. If prompted to give permission for the installer to run, click Yes. ... Click Next on the first screen. ... Select Install from Internet and click Next.
๐ŸŒ
Codeforwin
codeforwin.org โ€บ home โ€บ how to compile and run c program using command line in windows
How to compile and run C program using command line in Windows - Codeforwin
July 20, 2025 - Click on File โ†’ Save As in the menu bar. Alternatively, hit Ctrl + S to open Save As dialog box. Give some name to your first C program. Add .c extension at the end of your file name.
๐ŸŒ
YouTube
youtube.com โ€บ watch
How to Compile and Run a C Program from Command Prompt in Windows Computer - YouTube
In this C Programming Language tutorial, we will show you how to compile and run a C program from the command prompt on a Windows computer. The video covers ...
Published ย  February 19, 2025
๐ŸŒ
Learn C++
learncplusplus.org โ€บ home โ€บ c++ โ€บ c++17 โ€บ how to compile a c program on windows?
How To Compile A C Program On Windows? - Learn C++
October 24, 2022 - In C++ Builder you can simply press Run Button (without debugging or with debugging) or F9 key to compile and run your code, or you can use Run Menu to compile and run too. If you want to run this program in Console, then select the RAD Studio ...
๐ŸŒ
Wikihow
wikihow.com โ€บ computers and electronics โ€บ operating systems โ€บ windows โ€บ simple ways to run c program in command prompt
How to Run a C Program Using Developer Command Prompt
March 25, 2025 - You can easily do so using the developer command prompt for Visual Studio, which is free to download for personal use. The developer command prompt works just like the standard command prompt, but has extra developer commands, such as the ability ...
๐ŸŒ
CASS
cass-kul.github.io โ€บ tutorials โ€บ compiling-c
Compiling C | CASS
You can paste text by pressing CTRL+SHIFT+V or if you're using Windows, also by right clicking into the terminal window. # After you are done with the changes to the file, you exit nano by pressing CTRL+X and can confirm or deny that the file should be saved by pressing Y or N and confirming with ENTER. Now, you can compile and run your program with the following commands:
๐ŸŒ
W3Resource
w3resource.com โ€บ c-programming โ€บ compile-and-execute-c-program-in-linux-and-windows.php
Compile and execute C program in Linux and Windows - w3resource
April 8, 2026 - You may start programming by clicking on File > New > Source File in the window. Note that while saving the file, you must select file type as C as this IDE supports C++ also. You may use F9 or as shown below to Compile and Run program.
๐ŸŒ
Quora
quora.com โ€บ How-do-I-compile-and-run-C-programs-in-the-command-line-using-notepad-in-Windows
How to compile and run C programs in the command line using notepad in Windows - Quora
Answer (1 of 12): To learn any programming language ,it is better to start with notepad instead of using any IDE to write and execute programs. You can use TDM-GCC MinGW compiler. to download it use the link below: TDM-GCC MinGW Compiler 1.Now how to install TDM-GCC MinGW:- after download is ...
๐ŸŒ
Nullprogram
nullprogram.com โ€บ blog โ€บ 2016 โ€บ 06 โ€บ 13
Four Ways to Compile C for Windows
June 13, 2016 - Now, I have absolutely no interest in Visual Studio, but fortunately the Visual C++ compiler and associated build tools can be used standalone, supporting both C and C++. Included is a โ€œvcvarsโ€ batch file โ€” vcvars64.bat for x64. Execute that batch file in a cmd.exe console and the Visual C++ command line build tools will be made available in that console and in any programs executed from it (your editor).
๐ŸŒ
Medium
medium.com โ€บ @bryanahusna โ€บ how-to-setup-and-run-c-code-on-windows-pc-14be6980c1f
How to Setup and Run C Code on Windows PC | by Bryan Amirul Husna | Medium
January 2, 2022 - To do the command, write one line, press enter, and then write the next line and enter again. ... Then, to compile your C++ code, run this command on CMD. ... After the compilation process, you will notice a new .exe file has been created.
๐ŸŒ
Unstop
unstop.com โ€บ home โ€บ blog โ€บ how to run c program | step-by-step guide + detailed examples
How To Run C Program | Step-by-Step Guide + Detailed Examples
September 16, 2024 - Alternatively, you can press Ctrl + Shift + F9 to compile the current program file. If successfully compiled, it shows a descriptive message at the bottom of the window and the object file and the executable file will be created in the folder ...