> ## Content Index
> Fetch the complete content index at: https://developerinsider.co/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to pass Command Line Arguments in Turbo C++
- URL: https://developerinsider.co/how-to-pass-command-line-arguments-in-turbo-cpp/
- Published: 2017-05-01T14:49:00.000Z
- Updated: 2018-03-29T17:01:03.000Z
- Author: Vineet Choudhary
- Tags: Primary, Turbo C++

The following are the steps to execute a program with Command Line Argument inside Turbo C/C++ Compiler :

## 1\. Open Turbo C++

Open Turbo C++. If you don't have, you can download Turbo C++ from [here](https://developerinsider.co/download-turbo-c-for-windows-7-8-8-1-and-windows-10-32-64-bit-full-screen/).

## 2\. Write a program

Following is a simple example which checks if there is any argument supplied from the command line and take action accordingly −

```c
#include <stdio.h>
#include <conio.h>

void main( int argc, char *argv[] )  {  
   clrscr();
   if( argc == 2 ) 
   {
      printf("The argument supplied is %s\n", argv[1]);
   }
   else if( argc > 2 ) 
   {
      printf("Too many arguments supplied.\n");
   }
   else 
   {
      printf("One argument expected.\n");
   }
   getch();
}

```

[Click here to open this program in Turbo C++](https://developerinsider.co/assets/pages/runturbocpp.html?run=turbocpp:~developerinsider.co~https://github.com/developerinsider/C-Programming-Example/blob/master/CommandLineArgs/ARGS.C?raw=true~ARGS.C)

## 3\. Compile and Run your program

When the above code is compiled and executed by Turbo C++, it produces the following result

```
One argument expected.

```

## 4\. Open DOS Shell

Now open Turbo C++ File Menu (You can use shortcut Alt+F) and select DOS Shell.  
![](https://github.com/developerinsider/developer-insider-content/blob/master/POST/Tools/TurboC/2OpenDOSShell.png?raw=true)

## 5\. Change directory

Now you need to change the current directory of DOS Shell to "SOURCES" from "BIN", for this you need to user `cd` command.

- First use `cd..` for coming back to Turbo C++ main directory  
```  
  cd..  
```
- Now use `cd SOURCE` to access the SOURCE directory  
```  
  cd SOURCE  
```

![](https://github.com/developerinsider/developer-insider-content/blob/master/POST/Tools/TurboC/3CDSOURCE.png?raw=true)

## 6\. Execute Program with Command Line Arguments

![](https://github.com/developerinsider/developer-insider-content/blob/master/POST/Tools/TurboC/4ARGSTEsting.png?raw=true)

```
ARGS.EXE testing  

```

Here `ARGS.EXE` is the executable of your program `ARGS.C` and `testing` is a command line argument. When you'll hit the enter, it produces the following result

```
The argument supplied is testing  

```

![](https://github.com/developerinsider/developer-insider-content/blob/master/POST/Tools/TurboC/5Result.png?raw=true)