Skip to content

Custom PowerShell Command to compile & run c program in the Windows Terminal.

Notifications You must be signed in to change notification settings

SC2003/custom-c-command

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Custom C Compiler Command

A Powershell Command that writes:

gcc -o filename.exe filename.c && filename.exe

by simply writing:

c filename 

[without any .c&.exe]

Installation

Download the c.ps1 file.

Add the following code in your Powershell Profile/Config file.

#C_Script
$c_script = Join-Path $PSScriptRoot ".\custom\c.ps1"
. $c_script  | Invoke-Expression

Change the location inside:-

""

To your downloaded .ps1 file's location.

If you don't know the location of your Powershell Profile

Just type the following command in your terminal:-

echo $PROFILE

And you'll see something like:-

C:\Users\Yoo\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

And you should be done with the Installation.

Actual Use

To use the command write a C program in your current dir or change to a already written one.

Example C program: helloworld.c

#include<stdio.h>
int main() {
    printf("Hello, World!");
    return 0;
}

Now to Compile and Run the code simple type:

c helloworld

Like This:

Screenshots

Command: App Screenshot Output: App Screenshot

Contributing

Contributions are always welcome!

See c.ps1|Source Code for ways to get started.

About

Custom PowerShell Command to compile & run c program in the Windows Terminal.

Topics

Resources

Stars

Watchers

Forks