注册控制台应用程序以在任何目录中工作

编程入门 行业动态 更新时间:2024-10-25 18:31:18
本文介绍了注册控制台应用程序以在任何目录中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我写了一个控制台应用程序。我想知道是否有一种方法可以以某种方式注册它以便我可以从任何地方调用它,有点像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.

更多推荐

注册控制台应用程序以在任何目录中工作

本文发布于:2023-11-05 04:03:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1559843.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控制台   应用程序   工作   目录中

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!