陈晓猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: :: 管理 ::

搜狗浏览器没有提供卸载快捷方式,从控制面板调用太慢了,写了个VBS脚本实现:

Dim msg
msg = MsgBox("卸载搜狗浏览器,确定要卸载吗?", vbOKCancel + vbExclamation, "运行脚本确认")
If msg = vbOK Then
Dim oFSO, oFolder, oSubFolders, oSubFolder, oFiles, oFile
Dim OutputLog, strPathName
strPathName = CreateObject("Wscript.Shell").RegRead("HKEY_CURRENT_USER\Software\SogouExplorer\")
'strPathName = "C:\Documents and Settings\Administrator\Local Settings\Application Data\SogouExplorer\"
strFilename = "UninsSE.exe"
TranverseFile (strPathName)
End If

'自定义函数
Function TranverseFile(strPathName)
Set oFSO = CreateObject("scripting.filesystemobject")
Set oFolder = oFSO.GetFolder(strPathName)
Set oFiles = oFolder.Files

For Each oFile In oFiles
If StrComp(LCase(oFSO.GetfileName(oFile)), LCase(strFilename)) = 0 Then
Dim WS
Set WS = CreateObject("Wscript.Shell")
WS.run """" & oFSO.GetAbsolutePathName(oFile) & """",1,False
Set WS = Nothing
Exit Function
End If
Next

Set oSubFolders = oFolder.subfolders
For Each oSubFolder In oSubFolders
TranverseFile (oSubFolder)
Next

Set oFSO = Nothing
Set oFolder = Nothing
Set oSubFolders = Nothing
Set oSubFolder = Nothing
Set oFiles = Nothing
Set oFile = Nothing
End Function

 

posted on 2017-02-17 10:55  陈晓猫  阅读(451)  评论(0编辑  收藏  举报