This message was deleted.
# _general
s
This message was deleted.
n
I don't think it's possible since it's really just linking that actual folder, and not creating a shortcut file to that folder.
j
But if I use the "add to Quick Access" from the context menu, it takes across the name and the icon......
n
Wait, so PS isn't bringing over the icon for you? It does for me, just like using the context menu would.
j
No, but I am using some Registry trickery to create the folder I am trying to pin to Quick Access
n
Ah, gotcha. Hopefully somebody else here has tried to do the same and will reply then.
j
Interesting that it works for "normal" folders though...
So for posterity, what you need is a desktop.ini file in the folder you are pinning to handle the icon and the window title
$o = new-object -com shell.application
$DesktopIni = @"
[.ShellClassInfo]
IconResource=C:\windows\system32\OneDrive.ico,0
"@
Add-Content "$($FolderLocation)\desktop.ini" -Value $DesktopIni
(Get-Item "$($FolderLocation)\desktop.ini" -Force).Attributes = 'Hidden, System, Archive'
(Get-Item $FolderLocation -Force).Attributes = 'ReadOnly, Directory'
$o.Namespace($ENV:OneDriveUserPath).Self.InvokeVerb("pintohome")
n
Shit, you know what? I knew that since I've done this very thing in the past (custom folder/shortcut icon).
j
Don't worry, I should have known it too - one of my new CTO colleagues sorted it for me in about five minutes
n
It's one of those things that I've done literally just once, years ago, and totally forgot about it.
j
I'm embarrassed to admit I've written articles setting up the desktop.ini files using Group Policy and didn't twig it
n
Found my lone example:
Copy code
#==============================================
# Change the desktop folder icon
#==============================================
New-Item -Path "$env:Public\Desktop\Remote Client $Build - DBUpdate\" -ItemType Directory -Force
$TargetDirectory = "$env:Public\Desktop\Remote Client $Build - DBUpdate\"

$DesktopIni = @"
[.ShellClassInfo]
IconResource="$PF\Microsoft\Edge\Application\EpicHHDBUpdt$Ver1.exe"
"@

Add-Content "$($TargetDirectory)\desktop.ini" -Value $env:Public\DesktopIni
(Get-Item "$($TargetDirectory)\desktop.ini" -Force).Attributes = 'Hidden, System, Archive'
(Get-Item $TargetDirectory -Force).Attributes = 'ReadOnly, Directory'
#==============================================
For an Epic folder and shortcut.
j
Remarkably similar 🙂
n
yep
I don't think I got my idea from your blog, but I'll laugh if I did.
j
The circle of life