方法一
创建“绿化.bat”
@echo off
set "curpath=%cd%"
set "curpath=%curpath:\=\\%"
set "regname=register.REG"
if exist %regname% del %regname%
echo REGEDIT4>>%regname%
echo.>>%regname%
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions]>>%regname%
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin]>>%regname%
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2]>>%regname%
echo "cygdrive prefix"="/cygdrive">>%regname%
echo "cygdrive flags"=dword:00000020>>%regname%
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/]>>%regname%
echo "native"="%curpath%">>%regname%
echo "flags"=dword:00000008>>%regname%
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin]>>%regname%
echo "native"="%curpath%/bin">>%regname%
echo "flags"=dword:00000008>>%regname%
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib]>>%regname%
echo "native"="%curpath%/lib">>%regname%
echo "flags"=dword:00000008>>%regname%
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options]>>%regname%
regedit /s "%regname%"
del %regname%
rem [create Cygwin.bat file]
set "cygwinpath=%cd%"
set "startname=Cygwin.bat"
if exist %startname% del %startname%
set "pa=%%pa" & set "th=th%%"
set "ho=%%ho" & set "me=me%%"
echo @echo off>>%startname%
echo.>>%startname%
echo %path:~0,2%>>%startname%
echo set path=%cygwinpath%\bin;%pa%%th%>>%startname%
echo set home=%cygwinpath%\home\%username%>>%startname%
echo cd %ho%%me%>>%startname%
echo.>>%startname%
echo bash --login -i>>%startname%
创建“清理注册表.bat”
set "regname=unregister.REG"
if exist %regname% del %regname%
echo REGEDIT4>>%regname%
echo.>>%regname%
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions2]>>%regname%
regedit /s "%regname%"
del %regname%
方法自然非常简单,把装好的cygwin文件夹搬家,然后把“绿化.bat”放到cygwin目录下,双击即可。
卸载也很方便,把“清理注册表.bat”放到cygwin目录下,双击。然后删除cygwin目录。
方法二
在cygwin目录中的cygwin.bat文件中加入如下内容:
%CD%\bin\mount -f -s -b "%CD%/bin" "/usr/bin"
%CD%\bin\mount -f -s -b "%CD%/lib" "/usr/lib"
%CD%\bin\mount -f -s -b "%CD%/" "/"
%CD%\bin\mount -s -b --change-cygdrive-prefix "/cygdrive"
然后。。。双击它就可以了。简单吧!
【update 1】
更新了注册表法里用到的BAT文件。解决了执行脚本后,$HOME变成/var/empty的问题。参考:idevel.cn wiki
没有评论:
发表评论