用于MS Windows的命令行实用程序,用于保持Windows路径变量整洁和简短。

pywinpath的Python项目详细描述


pywinpath是编辑%path%环境的交互式命令行工具 Windows 7上的变量。 用于在Windows 10之前管理%path%内容的板载工具 几乎不存在,很容易导致杂乱的%PATH %。 如果路径超过特定限制,windows将自动忽略 无法找到超过最大长度和可执行文件的条目。

当面对%path%时,pywinpath试图让您保持清醒。有很多免费工具 但是,要编辑%path%,我在python中找不到好的路径。 windows 10有自己的gui来操作%path%,我还没有看到。

在Windows上,将生成%path%的内容 来自两个注册表值:系统范围路径中的条目,后跟 用户特定路径中的条目。

  • User path: ^{tt1}$
  • System path: ^{tt2}$

pywinpath允许您操作这两个注册表值并执行 一些额外的技巧,请参见下面列出的特性。

使用python 3.5在windows 7(en-us)上开发和测试,所以不要 希望它能在python 2或其他系统上工作。请告诉我 如果它在其他组合中对你有用,如果没有打开一个问题 Github,给我一个补丁或者请求。

安装

pip install pywinpath

或者如果您想看到一些彩色输出(这将安装colorama):

pip install pywinpath[color]

功能

  • Warns you of a too long %PATH% on Windows 7
  • Normalization of PATH entries followed by …
  • Deduplication of system and user PATH variables
  • Purge non-existent directories from PATH variables
  • Shortening of PATH variables via junctions, e.g. C:Program Files… gets C:prg…
  • Insert entries at the beginning of the PATH

待办事项

  • Add possibility to call with arguments instead of as interactive menu
  • Move entries up and down and between sys and user path (only after dedup?)
  • Handle variable expansions in PATH definitions such as %USERPROFILE%
  • Automatically identify efficient sub-paths for shortening via junctions
  • More tests
  • Test on other Windows-Python3 combinations than Windows 7 - Python 3.5

注释

  • With Git for Windows installed, the following command should display a more readable PATH listing on the console: ^{tt5}$
  • Junctions work for PATH shortening, also accross local drives:
    1. >mklink /J C:prog(x86) “C:Program Files (x86)”
    2. >set PATH=c:prog(x86)Notepad++;%PATH%
    3. Notepad++.exe is found.
    4. Junctions can be deleted by rmdir, the target dir is left untouched.

由路径过长的Python错误引起:

D:\proj>activate
Deactivating environment "C:\Users\***\AppData\Local\Continuum\Anaconda3"...
Activating environment "C:\Users\***\AppData\Local\Continuum\Anaconda3"...
The input line is too long.
"PATH_NO_SCRIPTS=C:\Users\***\AppData\Local\Continuum\Anaconda3;[...]"

一些链接:

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
JavaSpring重定向请求处理程序   SwingJava:拆分字符串并将其放入文本区域的   Java:标记“”上出现语法错误,此标记后面应为表达式   web服务Java RestService从日志文件写入和读取数据   java如何将ArrayList<String>转换为char数组,然后向后打印每个单词?   java SimpleDataFormat解析返回年终日期   加密Java aes解密bytebuffer,包括填充为空字节   java有没有办法从特定的if语句调用变量?   java从更新返回到渲染   spring GRPC Java登录测试   java为什么下面的代码不工作(StringBuffer.toString!=null)   java是一种可行的模式吗?   使用Spring集成测试的JavaOSGi片段   java jCommander为未知和未使用的值引发异常?   在imageView的editText中输入的java图像URL