如何使用 PowerShell 固定到任务栏 [英] How to pin to taskbar using PowerShell
本文介绍了如何使用 PowerShell 固定到任务栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将某些程序固定到 Windows 7 上的任务栏使用电源外壳?请逐步说明.
How can I pin some programs to taskbar on Windows 7 using PowerShell? Please explain step-by-step.
以及如何修改以下代码以将文件夹固定到任务栏?例如
And How to modify the following code to pin a folder to taskbar? For Example
$folder = $shell.Namespace('D:\Work')
在此路径中,example
命名文件夹.
In this path, example
named folder.
推荐答案
您可以使用 Shell.Application COM 对象调用 Verb
(固定到任务栏).下面是一些示例代码:
You can invoke a Verb
(Pin to Taskbar) using the Shell.Application COM object. Here's some example code:
http://gallery.technet.microsoft.com/scriptcenter/b66434f1-4b3f-4a94-8dc3-e406eb30b750
这个例子有点复杂.这是一个简化版本:
The example is somewhat complicated. Here is a simplified version:
$shell = new-object -com "Shell.Application"
$folder = $shell.Namespace('C:\Windows')
$item = $folder.Parsename('notepad.exe')
$verb = $item.Verbs() | ? {$_.Name -eq 'Pin to Tas&kbar'}
if ($verb) {$verb.DoIt()}
这篇关于如何使用 PowerShell 固定到任务栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文