看到有網友在51CTO曬
工具箱,其中,清理助手上榜率很高,不禁得產生共鳴,由於我也在用這一款強大的免費的工具軟件.....
轉正題,今天寫博記錄的是,爲助手寫的一個小工具中的幾個技術實現過程:
以下圖的置頂貼中:
![](http://static.javashuo.com/static/loading.gif)
技術實現1:尋找當前目錄下的助手,找到退出循環,不然沒有找到就指引用戶下載對應本身32位或者64位系統的清理助手版本:
$searchzhushou = FileFindFirstFile(@ScriptDir & "\*.exe")
While 1
$filezhuyu = FileFindNextFile($searchzhushou)
If @error = 1 Then
MsgBox(262144 + 16, "出錯了!", "抱歉,咱們沒有在本工具所在的目錄下找到官方正式的助手!" & @LF & "==緣由多是:" & @LF & @LF & "1.莫非您沒有把助手和本工具放在同一個目錄下?" & @LF & "2.清理助手主程序已被病毒破壞?" & @LF & "3.強烈建議從新下載可愛的清理助手最新版")
If @OSArch = "X86" Then
$downloadzhushou = "http://download.arswp.com/arswp3/x86/arswp3_x86.zip"
Else
$downloadzhushou = "http://download.arswp.com/arswp3/x64/arswp3_x64.zip"
EndIf
ShellExecute($downloadzhushou)
Exit
EndIf
If (FileGetVersion($filezhuyu, "CompanyName") = "Windows 清理助手") Then ExitLoop
WEnd
FileClose($searchzhushou)
技術實現2:隨機重命名
;接上
$zhoushoupath = StringSplit($filezhuyu, "\", 1)
$tmp = ""
For $i = 1 To $zhoushoupath[0] - 1 Step 1
$tmp = $tmp & $zhoushoupath[$i] & "\"
Next
$tmpname = @MSEC & @SEC & @YEAR & ".exe"
FileMove($filezhuyu, $$tmp & $tmpname, 1)
技術實現3:自動清除與修復
使用助手的命令行參數:" /auto /option=255 /udo=1 /fix=2"
若您看到本博之記錄,願多多指教。無比感謝。