Sto modificando gli script Chocolatey per includere la funzionalità Uninstall-ChocolateyPinnedTaskBarItem
.Come sbloccare la cartella "Libreria" dalla barra delle applicazioni usando Powershell?
Questa grande opera con il seguente comando
# WORKS
Uninstall-ChocolateyPinnedTaskBarItem "$env:ProgramFiles\Internet Explorer\iexplore.exe"
Ma non funziona con
# DOESN'T WORK
Uninstall-ChocolateyPinnedTaskBarItem "$env:SystemRoot\explorer.exe"
Come posso liberarmi di quello predefinito appuntato "Library" cartella utilizzando Powershell esclusivamente?
Ecco lo script di disinstallazione.
function Uninstall-ChocolateyPinnedTaskBarItem {
<#
.SYNOPSIS
Removes an item from the task bar linking to the provided path.
.PARAMETER TargetFilePath
The path to the application that should be launched when clicking on the task bar icon.
.EXAMPLE
Uninstall-ChocolateyPinnedTaskBarItem "${env:ProgramFiles(x86)}\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe"
This will remove the Visual Studio task bar icon.
#>
param(
[string] $targetFilePath
)
Write-Debug "Running 'Uninstall-ChocolateyPinnedTaskBarItem' with targetFilePath:`'$targetFilePath`'";
if (test-path($targetFilePath)) {
$verb = "Unpin from Taskbar"
$path= split-path $targetFilePath
$shell=new-object -com "Shell.Application"
$folder=$shell.Namespace($path)
$item = $folder.Parsename((split-path $targetFilePath -leaf))
$itemVerb = $item.Verbs() | ? {$_.Name.Replace("&","") -eq $verb}
if($itemVerb -eq $null){
Write-Host "TaskBar verb not found for $item. It may have already been unpinned"
} else {
$itemVerb.DoIt()
}
Write-Host "`'$targetFilePath`' has been unpinned from the task bar on your desktop"
} else {
$errorMessage = "`'$targetFilePath`' does not exist, not able to unpin from task bar"
}
if($errorMessage){
Write-Error $errorMessage
throw $errorMessage
}
}
Funziona perfettamente in Windows 7 con Powershell v3. Quali versioni di Windows e PowerShell sono in esecuzione? –
Ho appena usato la funzione per rimuovere un elemento aggiunto su Win8/PowerShell 3.0. –
gli oggetti appuntati vanno bene ... funziona alla grande. Quello che non funziona è sbloccare il *** Cartella Biblioteca *** –