注册控制台应用程序以在任何目录中工作 [英] Register console app to work from any directory

查看:111
本文介绍了注册控制台应用程序以在任何目录中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个控制台应用程序。我想知道是否有一种方法可以以某种方式注册它以便我可以从任何地方调用它,有点像git。



所以,我可以打开控制台窗口然后去:



myApp -myParams



提前谢谢,

Dom

解决方案

您可以将您的exectuable放在 Windows可执行搜索路径 [ ^ ],或者您可以修改后者以包含应用程序的文件夹。


虽然这与编程无关,但我认为您可以简单地将控制台应用程序的路径添加到PATH系统变量:



Windows 7



从开始菜单中选择计算机

从上下文菜单中选择系统属性

单击高级系统m设置>高级选项卡

单击系统变量下的环境变量,找到PATH,然后单击它。

在编辑窗口中,通过添加应用程序的位置来修改PATH PATH的值。如果您没有PATH项,您可以选择添加一个新变量并添加PATH作为名称和类的位置作为值。

重新打开命令提示符窗口,然后运行您的应用程序

I have written a console app. I want to know if there is a way that I can somehow "register" it so that I can call it from anywhere, kind of like git.

So, I can open a console window and just go:

myApp -myParams

Thanks in advance,
Dom

解决方案

You may put your exectuable in one of the folders included in the Windows executable search path[^], or you may modify the latter to include your application''s folder.


Although this has nothing to do with programming, I think you can simple add the path of your console application to the PATH system variable:

Windows 7

Select Computer from the Start menu
Choose System Properties from the context menu
Click Advanced system settings > Advanced tab
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of your application to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
Reopen Command prompt window, and run your app.


这篇关于注册控制台应用程序以在任何目录中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆