Board logo

标题: 添加path的程序 [打印本页]

作者: defrag     时间: 2008-7-27 15:36    标题: 添加path的程序

用起来还可以
@echo off
:: 添加PATH  -  padd.bat (find.exe)
if %1#==# goto end
if %1#==l# goto atlast

:: 插入path首
path|find /i "%1">NUL
if errorlevel 1 path=%1;%path%
goto end

:: 插入path尾
:atlast
path|find /i "%1">NUL
if errorlevel 1 path=%path%;%1

:end

作者: defrag     时间: 2008-7-27 15:47    标题: 添加append的程序

@echo off
append|find /i "%1">nul
if not errorlevel 1 goto end
append|aplsr %1>nul

需要的文件:http://www.fs2you.com/files/7e654ba6-5bae-11dd-b99f-0014221b798a/
作者: tireless     时间: 2008-7-27 16:50
Windows Resource Kit Tools 里有个这样的工具 pathman.exe (6.5K)

  Quote:
USAGE:

        /as path[;path[;path ...]]
                Adds the semicolon-separated paths to the system path.

        /au path[;path[;path ...]]
                Adds the semicolon-separated paths to the user path.

        /rs path[;path[;path ...]]
                Removes the semicolon-separated paths from the system path.

        /ru path[;path[;path ...]]
                Removes the semicolon-separated paths from the user path.

下载链接: http://clip2net.com/page/m316/259772

[ Last edited by tireless on 2008-7-26 at 08:55 PM ]
作者: HAT     时间: 2008-7-27 19:57
用批处理不是也可以实现吗?用这个第三方工具干吗?
作者: tireless     时间: 2008-7-27 23:45
这个?
wmic ENVIRONMENT where "name='path' and username='<system>'" set VariableValue="%path%;c:\test"

执行速度很慢啊
作者: pusofalse     时间: 2008-7-28 01:39


  Quote:
Originally posted by tireless at 2008-7-27 11:45 PM:
这个?
wmic ENVIRONMENT where "name='path' and username='<system>'" set VariableValue="%path%;c:\test"

执行速度很慢啊

又学到了新方法~^_^
作者: dslz666     时间: 2008-7-28 15:06


  Quote:
Originally posted by tireless at 2008-7-27 11:45 PM:
这个?
wmic ENVIRONMENT where "name='path' and username='<system>'" set VariableValue="%path%;c:\test"

执行速度很慢啊

这样好呀,不用借助第三方工具,谢谢分享
作者: nafan     时间: 2008-11-13 15:59
用这个程序难道有什么另外的想法?