【问题标题】:Pinning Metro Apps To Taskbar Windows 10 Powershell将 Metro 应用程序固定到任务栏 Windows 10 Powershell
【发布时间】:2017-08-23 17:54:04
【问题描述】:

在给定 AUMID 的情况下,以下代码将固定 Metro 应用以启动

如果你改变了

-match 'Pin To Start'

很遗憾,将匹配更改为“固定到任务栏”不起作用。这是怎么回事?

function Pin-Taskbar {    param(
        [string]$aumid,
        [switch]$unpin
    )
    try{
        if ($unpin.IsPresent){
            ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Path -eq $aumid}).Verbs() | ?{$_.Name.replace('&','') -match 'Unpin from Taskbar'} | %{$_.DoIt()}
            return "App '$aumid' unpinned from Taskbar"
        }else{
            ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Path -eq $aumid}).Verbs() | ?{$_.Name.replace('&','') -match 'Pin to Taskbar'} | %{$_.DoIt()}
            return "App '$aumid' pinned to Taskbar"
        }
    }catch{
        Write-Error "Error Pinning/Unpinning App! (App-Name correct?)"
    }
}


Pin-Taskbar king.com.CandyCrushSaga_kgqvnymyfvs32!App

【问题讨论】:

标签: c# windows powershell


【解决方案1】:

我假设你是一个好公民,不想在用户的任务栏上发送垃圾邮件。

在以前的 Windows 版本中,您可以使用动词 Pintotaskbar 以编程方式将程序取消/固定到任务栏。

$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 10 中不再有效。动词 Pintotaskbar 根本无法exist 访问。

因此,未经批准的第 3 方命令提示实用程序 名为SysPin 被赋予了生命——它允许你做你想做的事(尽管它不适用于每个应用程序,尤其是 UWP/Metro 应用程序)。

不过,从 Windows 10 版本 1607 开始,官方有了新的方式:添加一个 TaskbarLayout>
见:Customize Pinned Items on Taskbar in Windows 10 1607 during OSD with ConfigMgr

【讨论】:

  • 我不想向用户发送垃圾邮件任务栏。正如您所说,动词在 Win 10 中不再存在。糟糕的是我只对 Win 10 和 Metro 应用程序感兴趣。 SysPin 不会固定 Metro 应用程序。对于 Win 10 中的 Metro 应用程序,您还能想到其他方法吗?
  • 这不是真的。动词非常仍然存在。只是不是每个人都可以使用。
猜你喜欢
  • 2015-10-21
  • 2010-12-22
  • 2020-06-05
  • 2020-05-03
  • 1970-01-01
  • 2012-03-09
  • 1970-01-01
  • 2010-11-30
  • 2010-11-18
相关资源
最近更新 更多