开发者

How can i make a custom dos command like cp/md/ren etc

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.


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\"


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:

How can i make a custom dos command like cp/md/ren etc


(source: vlaurie.com)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜