windows 如何在Windows 10中将文件夹添加到`Path`环境变量(附截图)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44272416/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to add a folder to `Path` environment variable in Windows 10 (with screenshots)
提问by MatPag
On StackOverflow and on the net in general, there are outdated and few guides on how to add a specific folder to the Windows 10 Path
environment variable of the user.
在 StackOverflow 和一般的网络上,关于如何将特定文件夹添加到用户的 Windows 10Path
环境变量的指南已经过时且很少。
I think a complete guide for new developers with step by step instructions and screenshots could be really usefull to help them executing utilities from a Command Promptwithout the need of the full path, simplifying the things.
我认为为新开发人员提供分步说明和屏幕截图的完整指南可能非常有用,可以帮助他们从命令提示符执行实用程序,而无需完整路径,从而简化事情。
回答by MatPag
For the guide below we want to add an example utility called mytool.exe
which is located in C:\Users\NewFolderInPath\mytool.exe
, so that everytime i want to execute the mytool utility i don't have to specify the full path.
对于下面的指南,我们要添加一个名为的示例实用程序mytool.exe
,它位于 中C:\Users\NewFolderInPath\mytool.exe
,这样每次我想执行 mytool 实用程序时,我都不必指定完整路径。
I used this as an example, you can replace the folder with something more realistic like the JDK bin directory located here C:\Program Files\Java\{JDK_VERSION}\bin
to execute javac
, keytool
or everything you want.
我以此为例,您可以将文件夹替换为更现实的内容,例如位于此处的 JDK bin 目录C:\Program Files\Java\{JDK_VERSION}\bin
以执行javac
,keytool
或者您想要的任何内容。
Step 1- Click on the
Windows
icon
第 1 步- 单击
Windows
图标
Step 2- Click on the
Settings
icon
第 2 步- 单击
Settings
图标
Step 3- Click on
System
第 3 步- 单击
System
Step 4- Click on
About
第 4 步- 单击
About
Step 5- Click on
System info
第 5 步- 单击
System info
Step 6- Click on
Advanced system settings
第 6 步- 单击
Advanced system settings
Step 7- Click on
Environment variables...
第 7 步- 单击
Environment variables...
Step 8- Select
Path
row and then clickEdit
步骤 8- 选择
Path
行,然后单击Edit
Step 9- Click
New
and then clickBrowse
, then in the next panel which will open you need to select the folder you want in thePath
. For the initial premise of this guide i will add the folderC:\Users\NewFolderInPath
步骤 9- 单击
New
然后单击Browse
,然后在将打开的下一个面板中,您需要在Path
. 对于本指南的初始前提,我将添加文件夹C:\Users\NewFolderInPath
Step 10- Click
OK
and click everyOK
button you will encounter to close every previous windows.
第 10 步- 单击
OK
并单击OK
您会遇到的每个按钮以关闭之前的每个窗口。
Step 11- Open a
command prompt (cmd)
and now you can execute your utility without specifying the full path.
第 11 步- 打开 a
command prompt (cmd)
,现在您可以在不指定完整路径的情况下执行您的实用程序。
NOTE : For every problems leave a comment below and i will answer as soon as i can. Good luck and happy coding :)
注意:对于每个问题,请在下面发表评论,我会尽快回答。祝你好运,编码愉快:)
回答by Nicholas Petersen
In addition to @MatPag's excellent answer, you can skip the first six of those steps by clicking on the Window icon (bottom left corner) and start typing "Environment", you'll see an option before even done typing that word saying: "Edit the system environment variables".
除了@MatPag 的出色回答之外,您还可以通过单击窗口图标(左下角)并开始输入“环境”来跳过这些步骤的前六个步骤,您甚至可以在输入该词之前看到一个选项说:“编辑系统环境变量”。
Then follow the remaining steps given by @MatPag
然后按照@MatPag 给出的其余步骤进行操作