绿色版软件无法设置成系统默认程序的解决方法

本文共4339个字,预计阅读时间需要11分钟 发布时间: 2023-10-31 共516人阅读

把以下代码保存为vbs文件,把里面GoogleChromePortable.exe替换为你绿色浏览器的可执行文件名(例如谷歌浏览器为chrome.exe)并与其放在同一文件夹下。运行即可,然后进系统设置就有一个GoogleChromePortable的浏览器选项,即为你所想设置的绿色浏览器

 

‘Registers Google Chrome Portable with Default Programs or Default Apps in Windows
‘chromeportable.vbs – created on May 20, 2019 by Ramesh Srinivasan, Winhelponline.com
‘v1.1 13-June-2019 – Enclosed file name parameter in double-quotes.
‘v1.2 10-Sept-2020 – Fixed ApplicationIcon path. And added other supported URL protocols.
‘v1.3 23-July-2022 – Minor bug fixes.

Option Explicit
Dim sAction, sAppPath, sExecPath, objFile, oFSO, sbaseKey, sbaseKey2, ArrKeys, regkey
Dim WshShell : Set WshShell = CreateObject(“WScript.Shell”)
Dim oFS0 : Set oFSO = CreateObject(“Scripting.FileSystemObject”)

Set objFile = oFSO.GetFile(WScript.ScriptFullName)
sAppPath = oFSO.GetParentFolderName(objFile)
sExecPath = sAppPath & “\GoogleChromePortable.exe”

‘Quit if GoogleChromePortable.exe is missing in the current folder!
If Not oFSO.FileExists (sExecPath) Then
MsgBox “Please run this script from Chrome Portable folder. The script will now quit.”, _
vbOKOnly + vbInformation, “Register Google Chrome Portable with Default Apps”
WScript.Quit
End If

If InStr(sExecPath, ” “) > 0 Then sExecPath = “””” & sExecPath & “”””
sbaseKey = “HKCU\Software\”

If WScript.Arguments.Count > 0 Then
If UCase(Trim(WScript.Arguments(0))) = “-REG” Then Call RegisterChromePortable
If UCase(Trim(WScript.Arguments(0))) = “-UNREG” Then Call UnregisterChromePortable
Else
sAction = InputBox(“Type REGISTER to add Chrome Portable to Default Apps.” & _
“Type UNREGISTER To remove.”, “Chrome Portable Registration”, “REGISTER”)
If UCase(Trim(sAction)) = “REGISTER” Then Call RegisterChromePortable
If UCase(Trim(sAction)) = “UNREGISTER” Then Call UnregisterChromePortable
End If

Sub RegisterChromePortable
sbaseKey2 = sbaseKey & “Clients\StartmenuInternet\Google Chrome Portable\”

WshShell.RegWrite sbaseKey & “RegisteredApplications\Google Chrome Portable”, _
“Software\Clients\StartMenuInternet\Google Chrome Portable\Capabilities”, “REG_SZ”
WshShell.RegWrite sbaseKey & “Classes\ChromeHTML2\”, “Chrome HTML Document”, “REG_SZ”
WshShell.RegWrite sbaseKey & “Classes\ChromeHTML2\AppUserModelId”, “Chrome Portable”, “REG_SZ”
WshShell.RegWrite sbaseKey & “Classes\ChromeHTML2\Application\AppUserModelId”, “Chrome Portable”, “REG_SZ”
WshShell.RegWrite sbaseKey & “Classes\ChromeHTML2\Application\ApplicationIcon”, sExecPath & “,0”, “REG_SZ”
WshShell.RegWrite sbaseKey & “Classes\ChromeHTML2\Application\ApplicationName”, “Google Chrome Portable”, “REG_SZ”
WshShell.RegWrite sbaseKey & “Classes\ChromeHTML2\Application\ApplicationDescription”, “Access the internet”, “REG_SZ”
WshShell.RegWrite sbaseKey & “Classes\ChromeHTML2\Application\ApplicationCompany”, “Google Inc.”, “REG_SZ”
WshShell.RegWrite sbaseKey & “Classes\ChromeHTML2\DefaultIcon\”, sExecPath & “,0”, “REG_SZ”
WshShell.RegWrite sbaseKey & “Classes\ChromeHTML2\shell\open\command\”, sExecPath & ” — ” & “””” & “%1” & “”””, “REG_SZ”

WshShell.RegWrite sbaseKey2, “Google Chrome Portable Edition”, “REG_SZ”
WshShell.RegWrite sbaseKey2 & “Capabilities\ApplicationDescription”, “Google Chrome Portable Edition”, “REG_SZ”
WshShell.RegWrite sbaseKey2 & “Capabilities\ApplicationIcon”, sExecPath & “,0”, “REG_SZ”
WshShell.RegWrite sbaseKey2 & “Capabilities\ApplicationName”, “Google Chrome Portable Edition”, “REG_SZ”

ArrKeys = Array (“FileAssociations\.htm”, _
“FileAssociations\.html”, _
“FileAssociations\.shtml”, _
“FileAssociations\.xht”, _
“FileAssociations\.xhtml”, _
“FileAssociations\.webp”, _
“URLAssociations\ftp”, _
“URLAssociations\http”, _
“URLAssociations\https”, _
“URLAssociations\irc”, _
“URLAssociations\mailto”, _
“URLAssociations\mms”, _
“URLAssociations\news”, _
“URLAssociations\nntp”, _
“URLAssociations\sms”, _
“URLAssociations\smsto”, _
“URLAssociations\tel”, _
“URLAssociations\url”, _
“URLAssociations\webcal”)

For Each regkey In ArrKeys
WshShell.RegWrite sbaseKey2 & “Capabilities\” & regkey, “ChromeHTML2”, “REG_SZ”
Next

WshShell.RegWrite sbaseKey2 & “DefaultIcon\”, sExecPath & “,0”, “REG_SZ”
WshShell.RegWrite sbaseKey2 & “shell\open\command\”, sExecPath, “REG_SZ”

‘Launch Default Apps after registering Chrome Portable
WshShell.Run “control /name Microsoft.DefaultPrograms /page pageDefaultProgram”
End Sub

Sub UnregisterChromePortable

sbaseKey2 = “HKCU\Software\Clients\StartmenuInternet\Google Chrome Portable”

On Error Resume Next
WshShell.RegDelete sbaseKey & “RegisteredApplications\Google Chrome Portable”
On Error GoTo 0

WshShell.Run “reg.exe delete ” & sbaseKey & “Classes\ChromeHTML2″ & ” /f”, 0
WshShell.Run “reg.exe delete ” & chr(34) & sbaseKey2 & chr(34) & ” /f”, 0

‘Launch Default Apps after unregistering Chrome Portable
WshShell.Run “control /name Microsoft.DefaultPrograms /page pageDefaultProgram”
End Sub

转载文章,请保留出处,(www.sfzyw.com)感谢您的支持
首发资源网 » 绿色版软件无法设置成系统默认程序的解决方法

常见问题FAQ

链接地址失效了怎么办?
例如蓝奏盘,https://www.lanzous.com/i1b2oib 把S改成m或i即可解决,或者请联系本站修复!
本站资源和文章版权声明
版权声明:本站部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们,减少损失。联系邮箱:1453316800@qq.com
点击下载链接不跳转怎么回事?
您好,QQ内打开是不跳转的,少部分浏览器也不跳转,一般的谷歌,UC了,搜狗 360等浏览器都可以跳转。

发表回复

提供最优质的资源集合

立即查看 了解详情