用 AutoHotkey 写了一个,实现方法是最小化打开“证书导入向导”,然后自动点击按钮。
http://pan.baidu.com/share/link?shareid=4252928280&uk=1124163200
示例:复制代码 源码:- #NoTrayIcon
- #SingleInstance off
- #NoEnv
- SetControlDelay -1
-
- IfEqual, 1,, goto usage
-
- Run, rundll32.exe cryptext.dll`,CryptExtAddCER %1%,, Min, pid
- WinWait, ahk_pid %pid%
- ControlClick2("Button2")
- ControlClick2("Button5")
- ControlClick2("Button6")
- SetTimer, ControlClick3, 200
- ControlClick2("Button1")
- return
-
- ControlClick2(Button)
- {
- global
- Loop
- {
- Sleep, 200
- WinGet, ControlList_Now, ControlList, ahk_pid %pid%
- IfEqual, ControlList_Now,, continue
- IfEqual, ControlList_Now, %ControlList_Last%, continue
- WinGet, ControlList_Last, ControlList
- ControlClick, %Button%, ahk_pid %pid%
- break
- }
- }
-
- ControlClick3:
- if pid_csrss =
- {
- Process, Exist, csrss.exe
- pid_csrss = %ErrorLevel%
- }
- WinWait, ahk_pid %pid_csrss%,, 0
- IfEqual, ErrorLevel, 1, return
- SetTimer, ControlClick3, off
- ControlClick, Button1
- return
-
- usage:
- text =
- (
- CER 证书自动安装工具
-
- 编写语言: AutoHotkey
- 已测试环境: XP SP2
-
- 用法: %A_ScriptName% <CER 文件>
- 示例: %A_ScriptName% "D:\test.cer"
- )
- MsgBox, %text%
复制代码
|