[英]How to run a dotnet console app from the command line using an alias
I know how to do this with batch files, you add the path to the system variable but I cannot seem to find the answer to my question anywhere.我知道如何使用批处理文件执行此操作,您将路径添加到系统变量,但我似乎无法在任何地方找到我的问题的答案。 Anyone knows?有谁知道?
example: Instead of navigating to the app directory and running dotnet run
I would like to just call a command like myApp
from any directory I'm in.示例:我不想导航到 app 目录并运行dotnet run
我只想从我所在的任何目录调用myApp
之类的命令。
PS: Im using windows 10. PS:我使用的是 windows 10。
First, you need to know which folders are in your path environment variable.首先,您需要知道路径环境变量中有哪些文件夹。 You can see those if you go to ControlPanel/System/Advanced settings/Environment Variables如果您将 go 到 ControlPanel/System/Advanced settings/Environment Variables,您可以看到这些
So, you either use one of the existing folders, or you add a new folder.因此,您要么使用现有文件夹之一,要么添加一个新文件夹。
After that, you can can compile your dotnet core program to a.exe file.之后,您可以将您的 dotnet 核心程序编译为 .exe 文件。 See this answer for details on how to do that.有关如何执行此操作的详细信息, 请参阅此答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.