#NoTrayIcon #SingleInstance, Force #NoEnv ; somewhat ironic... ;Thinkai添加命令行 命令行仅添加进path,不是覆盖 ;出处:http://www.autohotkey.com/board/topic/63210-modify-system-path-gui if 0 = 0 { ; this won't work in vista/7 if it's not run as an administrator. ; i'm too lazy to request it manually so the easiest way is to ; compile this script, and then under Compatibility tab in the ; compiled exe's Properties select "Run as Administrator" RegRead, P, HKLM, SYSTEMCurrentControlSetControlSession ManagerEnvironment, PATH Gui, +Delimiter`; width := 400 Gui, Add, Text, w%width%, Double Click an entry to modify it. Click Add to make a new entry and Delete to remove the selected entry. Gui, Add, ListBox, vSysPath w%width% r8 +0x100 gEditEntry AltSubmit, %P% Gui, Font, s12 Gui, Add, Button, gNew w70 section , New Gui, Add, Button, gDelete w70 ys xs+74 , Delete Gui, Add, Button, gExit w70 ys xs+330, Cancel Gui, Add, Button, gSubmit w70 ys xp-74, Submit Gui, Show, , SysEnv -- Change System Environment Variable return } Else { addpath = %1% RegRead, oldpath, HKLM, SYSTEMControlSet001ControlSession ManagerEnvironment, Path RegWrite, REG_SZ, HKLM, SYSTEMControlSet001ControlSession ManagerEnvironment, Path, %oldpath%;%addpath% RegWrite, REG_SZ, HKLM, SYSTEMCurrentControlSetControlSession ManagerEnvironment, Path, %oldpath%;%addpath% SendMessage, 0x1A, 0,"Environment",, ahk_id 0xFFFF ExitApp } EditEntry: if (a_guievent == "DoubleClick" && a_eventinfo) { Gui +OwnDialogs RegExMatch(P, "P)^(?:(?[^;]*)(?:;|$)){" a_eventinfo "}", _) _En := IB( "Edit PATH entry", substr(P, _PosE, _LenE)) if (ErrorLevel == 0) { if (InStr(FileExist(ExpEnv(_En)),"D")) { rP := substr(P, 1, _PosE-1) _En (_PosE+_LenE+1 0 ? ";" : "") add GuiControl, , SysPath, `;%P% } return Delete: GuiControlGet, entry, , SysPath if (entry) { Gui, +OwnDialogs MsgBox, 4, SysEnv -- Confirm, Remove entry #%entry% from PATH? IfMsgBox Yes { RegExMatch(P, "P)^(?:(? [^;]*)(?:;|$)){" entry "}", _) P := SubStr(P, 1, max(_PosE-2,0)) (_PosE+_LenE+1 b ? a : b } ExpEnv(str) { ; by Lexikos: http://www.autohotkey.com/forum/viewtopic.php?p=327849#327849 if sz:=DllCall("ExpandEnvironmentStrings", "uint", &str, "uint", 0, "uint", 0) { VarSetCapacity(dst, A_IsUnicode ? sz*2:sz) if DllCall("ExpandEnvironmentStrings", "uint", &str, "str", dst, "uint", sz) return dst } return "" }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。