views:

61

answers:

2

Hi, i am using c# language to build a console application. My target is i have to build a custom command like "do pfizer.text" and it'll create a file "phizer.text" on desktop.

I know i can do this with existing commands but i want to make my custom command ( "do" in this case).

Can anyone tell me how to do this ??? I will prefer c# language as solution language.

Thanks, -seoul.

+3  A: 

The command line (not DOS for a long while now) will search for executables or scripts in all folders defined on the %Path% system variable. By adding the path of your program to that variable you can start it from anywhere.

You can find these variables at the System Properties dialog:

Kobi
Oh....good answer mate, didn't see this replying above comment :-)
seoul
+4  A: 

Just create your own console application with the name of command. Place this application on any folder included in %PATH% OR add your folder path to the %PATH%.

To check current paths -

  1. Open cmd
  2. Type path

To add new path -

  1. Open cmd
  2. Type set path="%path%;c:\mypath\"
Ramesh Soni
I have no idea about %PATH% .......Suppose, i created application as "example.exe" on "c:/programs" directory. Then what i need to do ??
seoul
updated the answer. Please check.
Ramesh Soni