Properties - desktop.ini

Discussion related to "Everything" 1.5 Alpha.
Post Reply
Posts: 4
Joined: Mon Nov 14, 2016 5:58 pm

Properties - desktop.ini

Post by Marco77 » Wed Jul 14, 2021 12:09 pm

void wrote:
Sat Mar 13, 2021 2:03 am
Set folder properties

To set properties for a folder (advanced):
[*]Set the Filename to: Desktop.ini
[*]Click Save.
Wow I thought directly editing the desktop.ini file was a bit hack-ish but then I had a close look:
Add-Type -path "Microsoft.WindowsAPICodePack.dll"
Add-Type -path "Microsoft.WindowsAPICodePack.Shell.dll"
$shellobj = [Microsoft.WindowsAPICodePack.Shell.ShellObject]::FromParsingName($pwd)
$shellobj.Properties.System.Subject.Value = 'TestSubject'

The COM property writer yields an error (invalid cast) when trying to write to a folder's properties - Exception calling "GetPropertyWriter" with "0" argument(s): "Unable to get writable property store for this property."

When doing it from the C# side, you (try to) obtain an
, either through IShellItem2.GetPropertyStore() or with the helper SHGetPropertyStoreFromParsingName().
This returns an HRESULT 0x80004002 (E_NOINTERFACE) when you pass GPS_READWRITE (0x2) but only on folders.
Bummer :/

Post Reply