我正在尝试使用以下代码将一个程序固定到Windows 10(RTM)的任务栏上:
$shell = new-object -com "Shell.Application"
$folder = $shell.Namespace((Join-Path $env:SystemRoot System32\WindowsPowerShell\v1.0))
$item = $folder.Parsename('powershell_ise.exe')
$item.invokeverb('taskbarpin');
这在Windows 8.1上有效,但在Windows 10上不再有效。
如果我执行$item.Verbs()
,我会得到以下结果:
Application Parent Name
----------- ------ ----
&Open
Run as &administrator
&Pin to Start
Restore previous &versions
Cu&t
&Copy
Create &shortcut
&Delete
Rena&me
P&roperties
正如您所看到的,没有动词可以将其固定在任务栏上。但是,如果我右键单击该特定文件,选项就在那里:
问题:
我是不是遗漏了什么?
在Windows 10中,有没有一种将程序固定在任务栏上的新方法?
9条答案
按热度按时间dfuffjeb1#
非常好!我对PowerShell示例做了一些小调整,希望您不介意:)
anauzrmj2#
我有同样的问题,我仍然不知道如何处理它,但这个小命令行工具做到了:
http://www.technosys.net/products/utils/pintotaskbar
您可以像这样在命令行中使用它:
将程序固定到任务栏并
来解开它。这对我来说很好。
dvtswwa33#
以下是Humberto的VBScript解决方案移植到PowerShell上:
mxg2im7a4#
在Windows10中,微软在显示动词之前添加了一个简单的复选标记。可执行文件的名称必须是EXPLORER.EXE。它可以在任何文件夹中,只是名称被选中。因此,在C#或任何编译程序中,最简单的方法就是重命名您的程序。
如果这是不可能的,您可以欺骗外壳对象,使其认为您的程序名为EXPLORER.EXE。我写了一篇文章here,讲述了如何在C#中通过更改PEB中的图像路径来完成此操作。
q7solyqu5#
抱歉,让这么古老的东西复活了。
我不知道如何在PowerShell中做到这一点,但在VBSCRIPT中,您可以使用我开发的这个方法。无论使用哪种系统语言,它都能正常工作。
可在Windows 8.x和10上运行。
脚本
命令行:
mdfafbf16#
参考我调整的@Humberto Freitas答案,你可以尝试这个VBScript,以便在Windows10中使用VBScript将程序固定到任务栏。
请参阅:Windows 10中的Microsoft Edge位于何处?我怎么才能启动它?
Microsoft Edge应该在任务栏中。它是蓝色的‘e’图标。
如果您没有或已取消固定,则只需重新固定即可。不幸的是,
MicrosoftEdge.exe
不能通过双击来运行,并且创建正常的快捷方式将不起作用。你可能就是在这个地方找到的。您需要做的只是在开始菜单或搜索栏中搜索Edge。看到Microsoft Edge后,右击它,然后固定到任务栏。
您可以使用以下VB脚本运行Microsoft Edge:Run-Micro-Edge.vbs
6tr1vspr7#
我用上面的答案作为动力,写了一个PowerShell类。我只是把它放到一个模块中,然后导入到我的其他脚本中。
下面的模块
72qzrwbm8#
警告:本页上的PowerShell/VBScript答案都不适用于Windows 10 21H2或Windows 11(此功能早在2019年就已中断)。
我只是粗略地说一下,这样人们就不会在这里浪费时间了。希望有人能更新上面的答案(因为它们是很好的答案,但由于微软做出了改变,所以不再起作用了,所以希望对这里的答案进行一些调整,可以让它们重新工作)。由于目前还没有用PowerShell将应用程序固定到任务栏上的已知方法(因为这个页面上的解决方案都不起作用),我知道唯一有效的解决方案是
syspin.exe
应用程序。请更新PowerShell的答案,因为这比使用syspin
要好得多。目前(令人遗憾的是),这个页面主要是一个“陷阱”;人们来到这里,很高兴地找到了这个问题的答案,结果却浪费了他们的时间去尝试那些都坏了的解决方案。r1zk6ea19#
我建议使用Windows 10的这一功能。它允许人们通过一个XML文件指定固定的程序(和其他东西)。