How to execute a c program using bat file in windows OS.
How to execute a c program using bat file in windows OS.
Step 1 :
Install gcc compiler or any compilerStep 2:
Create a file with extension XXX.bat using following code
REM - is command which mean comment (like in C as /* some comments about the code */)
REM set the compiler path to variable CC. Here SET is a command which put the compiler path in CC
SET CC="C:\TDM-GCC-64\bin\gcc.exe"
REM call compiler using CC between % symbol is syntax then “-o” command for creating object file then give the path of the object file with filename and extension then give the
REM XX.c file which is needs to be compiled.
%cc% -o E:\gopi\Official\C_learning\Hello_world.exe "E:\gopi\Official\C_learning\Hello_world.c"
REM Here executing the XXXX.exe will provide the out put.
E:\gopi\Official\C_learning\Hello_world.exe
Comments
Post a Comment