如何在Windows中管理PATH变量?

时间:2021-09-13 23:14:04

Every time I experiment with a new language, compiler, interpreter, tool, or whatever, and I want to run that from the command line, I would have to go to System and change my PATH variable. However, the box to put the monster string in consists of only a 1-line text box. I frequently find myself having to copy/paste the PATH string into Notepad just to edit it -- It's already over half a page. Right now I've counted about 30 different path URL's.

每次我尝试使用新语言,编译器,解释器,工具或其他任何东西,并且我想从命令行运行它时,我将不得不转到System并更改我的PATH变量。但是,放置怪物字符串的框只包含一行文本框。我经常发现自己必须将PATH字符串复制/粘贴到记事本中才能编辑它 - 它已经超过半页了。现在我已经计算了大约30个不同的路径URL。

Is there a better way to manage paths than to squeeze all of them into one string? I'm thinking of using SUSE for development since my PATH is so messed up.

是否有更好的方法来管理路径而不是将所有路径都压缩成一个字符串?我正在考虑使用SUSE进行开发,因为我的PATH非常混乱。

6 个解决方案

#1


If you always start the command line from one or a few shortcuts, you can run a batch file when it starts. For example:

如果始终从一个或几个快捷方式启动命令行,则可以在启动时运行批处理文件。例如:

cmd /k autoexec_console.cmd

where the batch file could have

批处理文件可以有的位置

set path=c:\foo;%path%

or anything else, and this would persist only for that cmd.exe instance.

或其他任何东西,这只会持续存在于该cmd.exe实例。


XP's Service Pack 2 Support tools (looks like there's one for SP3, but it doesn't say what's in it) comes with a program setx.exe that works like a permanent set.

XP的Service Pack 2支持工具(看起来有一个用于SP3,但它没有说明其中包含的内容)附带一个程序setx.exe,其作用类似于永久集。

#2


To better mange very long PATH in the default windows interface, you can have variable evaluated into variables :

要在默认的Windows界面中更好地管理非常长的PATH,可以将变量计算为变量:

SDKPATH -> some_sdk_path; some_more_sdk_paths; some_more_sdk_paths;
DEVPATH -> some_dev_path; some_more_dev_paths; %SDKPATH%
PATH    -> some_common_path; some_mode_paths; %DEVPATH%

#3


There is a really nice freeware environment editor available called RapidEE

有一个非常好的免费软件环境编辑器叫做RapidEE

Rapid Environment Editor

快速环境编辑

Rapid Environment Editor (RapidEE) is an environment variables editor.

Rapid Environment Editor(RapidEE)是一个环境变量编辑器。

It includes an easy to use GUI and replaces the small and inconvenient Windows edit box.

它包括一个易于使用的GUI,并取代了小而不方便的Windows编辑框。

RapidEE 8.x supports Windows XP, 2003, Vista, 2008, Windows 7, Windows 8 & Windows 10 (including 64-bit versions).

RapidEE 8.x支持Windows XP,2003,Vista,2008,Windows 7,Windows 8和Windows 10(包括64位版本)。

If you still use Windows NT or 2000, then use version 6.1. For Windows 9x or ME use version 2.1.

如果仍使用Windows NT或2000,则使用版本6.1。对于Windows 9x或ME,请使用2.1版。

Features

  • Editable tree: Show environment variables and values as an editable tree.
  • 可编辑树:将环境变量和值显示为可编辑树。

  • Portable mode: RapidEE doesn't require installation and could be run as a "portable application".
  • 便携式模式:RapidEE不需要安装,可以作为“便携式应用程序”运行。

  • Error checking: Automatically checking for invalid pathnames and filenames
  • 错误检查:自动检查无效的路径名和文件名

  • Multilanguage interface: RapidEE is translated into a number of languages (English, Russian, Japanese, French, Polish, German, Italian, Latvian, Slovak, Greek, Spanish, Chinese, Dutch, Swedish, Korean, Croatian, Danish, Brazilian Portuguese, Finnish, Norwegian, Indonesian, Romanian, Hungarian, Turkish, Abkhazian, Ukrainian, Czech, Arabic), and the language can be changed on the fly.
  • 多语言界面:RapidEE被翻译成多种语言(英语,俄语,日语,法语,波兰语,德语,意大利语,拉脱维亚语,斯洛伐克语,希腊语,西班牙语,中文,荷兰语,瑞典语,韩语,克罗地亚语,丹麦语,巴西葡萄牙语,芬兰语) ,挪威语,印度尼西亚语,罗马尼亚语,匈牙利语,土耳其语,阿布哈兹语,乌克兰语,捷克语,阿拉伯语),语言可以随时更改。

#4


When you're just experimenting with a one-shot language you can create a small startup batch file which manipulates the path:

当您只是尝试一次性语言时,您可以创建一个操作路径的小型启动批处理文件:

set PATH=C:\My\New\Language\bin;%PATH%

and create a small testing environment by creating a shortcut to

并通过创建一个快捷方式创建一个小的测试环境

cmd /k mybatch.cmd

where the path will be set to your liking. Otherwise you can edit the long string in the registry which may be slightly better than a 200px wide textbox.

路径将根据您的喜好设置。否则,您可以编辑注册表中的长字符串,这可能比200px宽的文本框略好。

#5


Use a batch (.BAT) file.

使用批处理(.BAT)文件。

#6


I'd recommend to try Environment variables editor (Eveditor). It is easy to use and completely free.

我建议尝试环境变量编辑器(Eveditor)。它易于使用且完全免费。

Environment variables editor helps you organize and streamline your use of system variables (including System PATH) and optimize your work environment without risk of losing valuable configuration settings, something that can happen inadvertently and with devastating effect when you install new software on your machine.

环境变量编辑器可帮助您组织和简化系统变量(包括系统路径)的使用并优化您的工作环境,而不会丢失有价值的配置设置,这可能会在您的计算机上安装新软件时无意中发生并具有破坏性影响。

#1


If you always start the command line from one or a few shortcuts, you can run a batch file when it starts. For example:

如果始终从一个或几个快捷方式启动命令行,则可以在启动时运行批处理文件。例如:

cmd /k autoexec_console.cmd

where the batch file could have

批处理文件可以有的位置

set path=c:\foo;%path%

or anything else, and this would persist only for that cmd.exe instance.

或其他任何东西,这只会持续存在于该cmd.exe实例。


XP's Service Pack 2 Support tools (looks like there's one for SP3, but it doesn't say what's in it) comes with a program setx.exe that works like a permanent set.

XP的Service Pack 2支持工具(看起来有一个用于SP3,但它没有说明其中包含的内容)附带一个程序setx.exe,其作用类似于永久集。

#2


To better mange very long PATH in the default windows interface, you can have variable evaluated into variables :

要在默认的Windows界面中更好地管理非常长的PATH,可以将变量计算为变量:

SDKPATH -> some_sdk_path; some_more_sdk_paths; some_more_sdk_paths;
DEVPATH -> some_dev_path; some_more_dev_paths; %SDKPATH%
PATH    -> some_common_path; some_mode_paths; %DEVPATH%

#3


There is a really nice freeware environment editor available called RapidEE

有一个非常好的免费软件环境编辑器叫做RapidEE

Rapid Environment Editor

快速环境编辑

Rapid Environment Editor (RapidEE) is an environment variables editor.

Rapid Environment Editor(RapidEE)是一个环境变量编辑器。

It includes an easy to use GUI and replaces the small and inconvenient Windows edit box.

它包括一个易于使用的GUI,并取代了小而不方便的Windows编辑框。

RapidEE 8.x supports Windows XP, 2003, Vista, 2008, Windows 7, Windows 8 & Windows 10 (including 64-bit versions).

RapidEE 8.x支持Windows XP,2003,Vista,2008,Windows 7,Windows 8和Windows 10(包括64位版本)。

If you still use Windows NT or 2000, then use version 6.1. For Windows 9x or ME use version 2.1.

如果仍使用Windows NT或2000,则使用版本6.1。对于Windows 9x或ME,请使用2.1版。

Features

  • Editable tree: Show environment variables and values as an editable tree.
  • 可编辑树:将环境变量和值显示为可编辑树。

  • Portable mode: RapidEE doesn't require installation and could be run as a "portable application".
  • 便携式模式:RapidEE不需要安装,可以作为“便携式应用程序”运行。

  • Error checking: Automatically checking for invalid pathnames and filenames
  • 错误检查:自动检查无效的路径名和文件名

  • Multilanguage interface: RapidEE is translated into a number of languages (English, Russian, Japanese, French, Polish, German, Italian, Latvian, Slovak, Greek, Spanish, Chinese, Dutch, Swedish, Korean, Croatian, Danish, Brazilian Portuguese, Finnish, Norwegian, Indonesian, Romanian, Hungarian, Turkish, Abkhazian, Ukrainian, Czech, Arabic), and the language can be changed on the fly.
  • 多语言界面:RapidEE被翻译成多种语言(英语,俄语,日语,法语,波兰语,德语,意大利语,拉脱维亚语,斯洛伐克语,希腊语,西班牙语,中文,荷兰语,瑞典语,韩语,克罗地亚语,丹麦语,巴西葡萄牙语,芬兰语) ,挪威语,印度尼西亚语,罗马尼亚语,匈牙利语,土耳其语,阿布哈兹语,乌克兰语,捷克语,阿拉伯语),语言可以随时更改。

#4


When you're just experimenting with a one-shot language you can create a small startup batch file which manipulates the path:

当您只是尝试一次性语言时,您可以创建一个操作路径的小型启动批处理文件:

set PATH=C:\My\New\Language\bin;%PATH%

and create a small testing environment by creating a shortcut to

并通过创建一个快捷方式创建一个小的测试环境

cmd /k mybatch.cmd

where the path will be set to your liking. Otherwise you can edit the long string in the registry which may be slightly better than a 200px wide textbox.

路径将根据您的喜好设置。否则,您可以编辑注册表中的长字符串,这可能比200px宽的文本框略好。

#5


Use a batch (.BAT) file.

使用批处理(.BAT)文件。

#6


I'd recommend to try Environment variables editor (Eveditor). It is easy to use and completely free.

我建议尝试环境变量编辑器(Eveditor)。它易于使用且完全免费。

Environment variables editor helps you organize and streamline your use of system variables (including System PATH) and optimize your work environment without risk of losing valuable configuration settings, something that can happen inadvertently and with devastating effect when you install new software on your machine.

环境变量编辑器可帮助您组织和简化系统变量(包括系统路径)的使用并优化您的工作环境,而不会丢失有价值的配置设置,这可能会在您的计算机上安装新软件时无意中发生并具有破坏性影响。