Windows 10 重启后,从任务栏取消固定的项目会重新出现

Windows 10 重启后,从任务栏取消固定的项目会重新出现

我必须重新制作我的笔记本电脑映像,并重新配置它。映像中的一些项目固定到我的任务栏,当我取消固定它们时,它们会在重新启动后恢复。我看到很多关于清除 %AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar 和删除 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband 的评论。还有关于 c:\Users\Public\CompanyProfile(对我来说不存在)的注释。这些技巧都没有用。我甚至创建了一个新用户,并在该帐户上看到了同样的问题。我遇到的另一个症状是,当我将浏览器默认为 Firefox 时,它会在重新启动后重置为 IE。我已经检查过了,我找不到任何驱动此行为的组策略。我没有主意了。

已安装的程序和我放在桌面上的项目在重启后仍然有效。在查看周围情况时,我尝试使用批处理程序来提供帮助,并注意到如果我在 DOS 中运行以下命令:

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

它重置任务栏和文件关联。

答案1

我没有好的答案来永久解决问题。但是,我能够掩盖问题。我最终创建了一个在我登录时运行的任务。该任务运行下面的脚本并从任务栏中取消固定项目。

Option Explicit

Dim objFSO, objShell, objFile, objFolder, objFolderItem, colVerbs, objShellApp, objVerb
Dim strFileNameAndPath

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objShellApp = CreateObject("Shell.Application")

' ***********************************************
' Unpin Internet Explorer
' ***********************************************
strFileNameAndPath = objShell.ExpandEnvironmentStrings("%APPDATA%") & _
 "\Microsoft\Internet Explorer\Quick Launch\User Pinned\Taskbar\Internet Explorer.lnk"

 ' Verify the files exists.  If not, we are got and don't need to do Anything
If objFSO.FileExists(strFileNameAndPath) Then
    set objFile = objFSO.GetFile(strFileNameAndPath)
    Set objFolder = objShellApp.Namespace(objFile.ParentFolder & "\")
    Set objFolderItem = objFolder.ParseName(objFile.Name)
    Set colVerbs = objFolderItem.Verbs
    For Each objVerb In colVerbs
        If LCase(Replace(objVerb.name, "&", "")) = "unpin from taskbar" Then objVerb.DoIt
    Next
End If

' ***********************************************
' Unpin Windows File Explorer
' ***********************************************
Set objFolder = objShellApp.Namespace("C:\ProgramData\Microsoft\Windows\Start Menu Places")

For each objFolderItem in objFolder.Items
    If InStr(1, objFolderItem.Name, "Explorer", vbTextCompare) > 0 Then
        objFolderItem.InvokeVerb("taskbarunpin")
    End If
Next

Set objVerb = Nothing
Set colVerbs = Nothing
set objFile = Nothing
Set objFolder = Nothing
Set objFolderItem = Nothing
Set objFSO = Nothing
Set objShell = Nothing
Set objShellApp = Nothing

特别感谢 Syberdoor 帮助我找出文件资源管理器代码(通过脚本或批处理文件从 Windows 10 中的任务栏取消固定文件资源管理器

相关内容