Skip to content

Instantly share code, notes, and snippets.

@AzimsTech
Last active January 14, 2020 04:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AzimsTech/3123ad08e5224df413703707553a2f0a to your computer and use it in GitHub Desktop.
Save AzimsTech/3123ad08e5224df413703707553a2f0a to your computer and use it in GitHub Desktop.
Pin Quick Access shortcuts
<#
.NAME
Set-QuickAccessShortcut
.SYNOPSIS
Pin special folders to Quick Acess navigation pane.
.DESCRIPTION
Folder list: Users, Music, Pictures, Desktop, Documents, Videos, Downloads & Recycle Bin
#>
# To list all special folders:
# [Enum]::GetNames('System.Environment+SpecialFolder')
$o = new-object -com shell.application
$Users = [Environment]::GetFolderPath([System.Environment+SpecialFolder]::UserProfile)
$Music = [Environment]::GetFolderPath([System.Environment+SpecialFolder]::MyMusic)
$Pictures = [Environment]::GetFolderPath([System.Environment+SpecialFolder]::MyPictures)
$Desktop = [Environment]::GetFolderPath([System.Environment+SpecialFolder]::Desktop)
$Documents = [Environment]::GetFolderPath([System.Environment+SpecialFolder]::MyDocuments)
$Videos = [Environment]::GetFolderPath([System.Environment+SpecialFolder]::MyVideos)
$Downloads = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
$RecycleBin = 'c:\$RECYCLE.BIN'
$PinLists = @($Users, $Desktop, $Documents, $Downloads, $Music, $Pictures, $Videos, $RecycleBin)
foreach($PinList in $PinLists) {
New-Item -ItemType Directory -Force -Path "$PinList" | Out-Null
$o.Namespace($PinList).Self.InvokeVerb("pintohome")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment