删除任务栏上的 Google Chrome 固定图标

2023-11-30

我想删除任务栏上的 Google Chrome 固定图标。卸载不会删除图标。我修改了代码以仅删除 Google Chrome.lnk。我想要做的(了解 VBS)是循环遍历所有用户文件夹,而不仅仅是当前用户,我认为当前用户定义为strCurrentUserAppData。我想用此代码实现的另一个愿望是将其与 SCCM 一起使用来执行 Chrome 的全新安装。我安装的是x64版本,需要更换为x86版本。当我使用企业 MSI 进行卸载时,它会留下固定图标。如果我使用bat从目录中删除图标,lnk会被删除,但任务栏上会留下一个白皮书图标。到目前为止,这是唯一可用于删除固定图标的代码。

Option Explicit

Const CSIDL_APPDATA = &H1A

Dim objShell
Dim objFolder
Dim objFolderItem
Dim objVerb
Dim objCurrentUserAppData
Dim strCurrentUserAppData
Set objShell = CreateObject("Shell.Application")
Set objCurrentUserAppData = objShell.NameSpace(CSIDL_APPDATA)
strCurrentUserAppData = objCurrentUserAppData.Self.Path



'===================''==================='
' - Remove All Pinned Items -
'===================''==================='


Set objFolder = objShell.Namespace(strCurrentUserAppData & "\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar")


For Each objFolderItem in objFolder.Items
    'WScript.Echo objFolderItem
    If objFolderItem = "Google Chrome" then
        For Each objVerb in objFolderItem.Verbs
            If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
        Next
    End if
Next

即使重新启动后,我运行的批量代码仍然不会删除图标。

taskkill /im chrome.exe /f /t
taskkill /im GoogleUpdate.exe /f /t
taskkill /im GoogleCrashHandler.exe /f /t
taskkill /im GoogleCrashHandler64.exe /f /t
taskkill /im GoogleUpdateBroker.exe /f /t
taskkill /im GoogleUpdateHelper.msi /f /t
taskkill /im GoogleUpdateOnDemand.exe /f /t
taskkill /im GoogleUpdateSetup.exe /f /t
taskkill /im chrmstp.exe /f /t

MsiExec.exe /X{3EDA268B-C905-37D1-89DF-7049B39FB069} /q/n

MsiExec.exe /X{6A21C1E8-DAC1-3C18-BCDC-2DBB4B352AD8} /q/n

rem app files
rd "%userprofile%\AppData\Local\Google" /s/q
rd "C:\Users\Default\AppData\Local\Google" /s/q
rd "\Google" /s/q
rd "%PROGRAMFILES%\Google" /s/q
rd "%PROGRAMFILES(X86)%\Google" /s/q

rem desktop shorcuts
del "%PUBLIC%\Desktop\Google Chrome.lnk" /q
del "%userprofile%\Desktop\Google Chrome.lnk" /q

rem start menu folders
rd "%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Google Chrome" /s/q
rd "%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Google Chrome" /s/q

rem pinned items
del "%userprofile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Google Chrome*.lnk" /q
del "%userprofile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Google Chrome*.lnk" /q

taskkill /f /im explorer.exe
start explorer.exe

尝试这个混合代码(Vbscript/PowerShell):

Option Explicit
Dim Title,Ws,ByPassPSFile,AppPath,Example,PSFile,MyCmd,Result,MyArray,MyApp,FolderPath,fso
Title = "UnPin application from Taskbar on Windows 7 by Hackoo"
Set Ws = CreateObject("wscript.Shell")
Set fso = Createobject("Scripting.FileSystemObject")
PSFile = Left(Wscript.ScriptFullName, InstrRev(Wscript.ScriptFullName, ".")) & "ps1"
ByPassPSFile = "cmd /k PowerShell.exe -ExecutionPolicy bypass -noprofile -file "
Example = "C:\Program Files\Google\Chrome\Application\Chrome.exe "
AppPath = InputBox("Enter the path of your application in order to unpin it from the taskbar " & vbcr & "Example : " & vbcr & Dblquote(Example) & "",Title,Example)
If AppPath = "" or IsEmpty(AppPath) Then Wscript.Quit()
MyArray = Split(AppPath,"\")
MyApp = MyArray(UBound(MyArray))
FolderPath = fso.GetParentFolderName(AppPath)
MyCmd = "$sa = new-object -c shell.application" & VbCrlF
MyCmd = MyCmd & "$FolderPath = "& DblQuote(FolderPath) & VbCrlF
MyCmd = MyCmd & "$pn = $sa.namespace($FolderPath).parsename('"& MyApp &"')" & VbCrlF
MyCmd = MyCmd & "$pn.invokeverb('taskbarunpin')"
Call WriteMyPSFile(MyCmd)
Result = Ws.run(ByPassPSFile & PSFile,1,True)
'**********************************************************************************************
Sub WriteMyPSFile(strText)
Dim fs,ts,PSFile
Const ForWriting = 2
    PSFile = Left(Wscript.ScriptFullName, InstrRev(Wscript.ScriptFullName, ".")) & "ps1"
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set ts = fs.OpenTextFile(PSFile,ForWriting,True)
    ts.WriteLine strText
    ts.Close
End Sub
'**********************************************************************************************
Function DblQuote(Str)
    DblQuote = Chr(34) & Str & Chr(34)
End Function
'**********************************************************************************************

编辑:2015年6月22日:UnPinfromTaskBarHiddenConsole.vbs

Option Explicit
Dim Title,Ws,ByPassPSFile,AppPath,Example,PSFile,MyCmd,Result,MyArray,MyApp,FolderPath,fso
Title = "UnPin application from Taskbar on Windows 7 by Hackoo"
Set Ws = CreateObject("wscript.Shell")
Set fso = Createobject("Scripting.FileSystemObject")
PSFile = Left(Wscript.ScriptFullName, InstrRev(Wscript.ScriptFullName, ".")) & "ps1"
ByPassPSFile = "cmd /c PowerShell.exe -ExecutionPolicy bypass -noprofile -file "
Example = "C:\Program Files\Google\Chrome\Application\Chrome.exe "
AppPath = InputBox("Enter the path of your application in order to unpin it from the taskbar " & vbcr & "Example : " & vbcr & Dblquote(Example) & "",Title,Example)
If AppPath = "" or IsEmpty(AppPath) Then Wscript.Quit()
MyArray = Split(AppPath,"\")
MyApp = MyArray(UBound(MyArray))
FolderPath = fso.GetParentFolderName(AppPath)
MyCmd = "$sa = new-object -c shell.application" & VbCrlF
MyCmd = MyCmd & "$FolderPath = "& DblQuote(FolderPath) & VbCrlF
MyCmd = MyCmd & "$pn = $sa.namespace($FolderPath).parsename('"& MyApp &"')" & VbCrlF
MyCmd = MyCmd & "$pn.invokeverb('taskbarunpin')"
Call WriteMyPSFile(MyCmd)
Result = Ws.run(ByPassPSFile & PSFile,0,True)
MsgBox "The Unpin of " & DblQuote(MyApp) & " from the taskbar is done !",VbInformation,Title
'**********************************************************************************************
Sub WriteMyPSFile(strText)
Dim fs,ts,PSFile
Const ForWriting = 2
    PSFile = Left(Wscript.ScriptFullName, InstrRev(Wscript.ScriptFullName, ".")) & "ps1"
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set ts = fs.OpenTextFile(PSFile,ForWriting,True)
    ts.WriteLine strText
    ts.Close
End Sub
'**********************************************************************************************
Function DblQuote(Str)
    DblQuote = Chr(34) & Str & Chr(34)
End Function
'**********************************************************************************************
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

删除任务栏上的 Google Chrome 固定图标 的相关文章

随机推荐

  • Sympy:求解具有初始条件误差的微分方程

    SinceSympy版本 1 2 PythonSympy已经实现了在给定一些初始条件的情况下求解简单微分方程中的常数的能力 我试图测试此功能 但不断出现我不知道如何解决的错误 The 文档表示初始条件的格式如下 我尝试遵循实现该功能的实际拉
  • Java 和 SSH:维护连接

    目标 通过一个连接和多个会话或一个持久会话远程控制 ssh 服务器 问题 1 我目前使用 sshj 通过 SSH 进行一些远程控制 它运行良好 但我似乎无法让它正确处理提示 主机不提供真正的root权限 只提供sudo i 所以我需要先登录
  • 在android上模糊图像

    我想要模糊图像 我用过 public Bitmap mohu Bitmap bmpOriginal int hRadius int vRadius int width height r g b c a gry c1 a1 r1 g1 b1
  • 如何在 -(void)touchesMoved 期间仅调用一次方法?

    我在用 void touchesMoved每当我做某事enter特定的框架 在本例中是按钮的区域 我的问题是 我只希望它在我进入框架时做一些事情 not当我在框架内移动手指时 有谁知道我如何在框架内时仅调用一次方法 并且如果我在同一个 to
  • Delphi 使用可变参数列表调用 JNI 方法

    使用 Embarcadero 的 Jni api 单元 如何向需要它的 JNI 方法提供变量参数列表 例如 JNINativeInterface 的 CallStaticObjectMethodV 方法 清单 1 有一个 va list 类
  • 通过修改插件调用JEdtiable提交按钮

    解决方案 1 不使用 TinyMCE 如果您没有将 TinyMCE 与 JEditable 一起使用 请查看下面 Arman P 的帖子 解决方案 2 使用 TinyMCE 如果您使用 TinyMCE 那么不幸的是 Arman P s 方法
  • 获取自定义适配器中的项目列表

    那么 我有一个扩展 ArrayAdapter 的自定义适配器 我想从适配器内获取整个列表 可以这样做吗 我知道在 ArrayAdapter 构造函数中 您传入对象列表并将其存储为 mObjects 但该列表是私有的 我想在构造函数中的自定义
  • Python 2.7 中具有多个函数参数的多重处理

    我正在尝试实现多处理来加速复制循环 但无法让它在 Python27 中工作 这是我的程序的一个非常简化的版本 基于 SO 的文档和其他答案 例如用于多个参数的 Python multiprocessing pool map 我意识到关于多处
  • 使用 JQuery 获取图像的真实尺寸

    给定图像路径列表 如何迭代它们并找到实际的图像尺寸 我假设我必须将它们插入没有宽度或高度属性的 DOM 中 并对它们执行 width 和 height var paths path image png somewhere page jpg
  • 内存映射文件 java NIO

    我了解如何创建内存映射文件 但我的问题是在下面一行中说 FileChannel roChannel new RandomAccessFile file r getChannel ByteBuffer roBuf roChannel map
  • include_next 预处理器指令导致 MSVC 中出现问题

    我知道 inlcude next 恰好是 C 预处理器的 GNU 扩展 我在使用 MSVC 编译 Gnu 库代码时遇到问题 例如 有一个 stdio h 头文件或者更确切地说GNU like
  • Java / NetBeans - 如何进入 jar 文件?

    我在 Netbeans 中有一个 Java 项目 其属性的库部分列出了几个 jar 文件 我在其中一个 jar 文件中发现了一个错误 我想在调试时介入它 这是我到目前为止所做的 我已经找到了源代码 jar 文件 我将该源代码作为一个项目打开
  • 本地运行SAM时如何连接RDS实例?

    我正在使用 SAM 无服务器应用程序模型 在本地测试连接到云中的 Aurora RDS 实例的 Lambda 函数 使用以下命令 sam local invoke lambda function name event event json
  • 如何使用webp图片并支持safari

    由于压缩效果更好 我尝试在整个网站中使用 webp 图像 不过我知道 safari 不支持 webp 图像是使用加载的background image url img img webp 然后我应用其他background特性 我明白了
  • 在c中使用逗号运算符

    我读过逗号运算符用于分配表达式 并将正确的表达式提供给左值 但是为什么这个程序在不使用括号的情况下将左表达式分配给左值呢 我正在使用 Turbo C 编译器 int b 2 int a a b 2 b 5 prints 10 as expe
  • lua代码反混淆

    我最近下载了一些 lua 代码 我发现里面有一些混淆的字符串 这让我想知道那里使用了什么样的混淆技术 有人有想法吗 local code 27 76 117 97 81 0 1 4 4 4 8 0 64 0 0 0 64 67 58 92
  • Swift macOS 弹出窗口检测更改暗模式

    从图像中可以看出 我有一个弹出窗口 我必须确保当屏幕模式发生变化 深色模式或浅色模式 时 弹出窗口的颜色会发生变化 颜色取自资源 如下所示 NSColor named backgroundTheme withAlphaComponent 1
  • 在 Project Reactor 中处理数据的最佳方法

    在项目反应器中处理数据的最佳方法是什么 使用平面地图 public Mono
  • 旋转 MKMapView 的内容

    我需要根据罗盘值旋转mapView的内容 float myHeadingValue newHeading trueHeading 为了旋转地图 我使用这个 mapView setTransform CGAffineTransformMake
  • 删除任务栏上的 Google Chrome 固定图标

    我想删除任务栏上的 Google Chrome 固定图标 卸载不会删除图标 我修改了代码以仅删除 Google Chrome lnk 我想要做的 了解 VBS 是循环遍历所有用户文件夹 而不仅仅是当前用户 我认为当前用户定义为strCurr