Hi wfr,

It seems that the values of the enumeration in HEX are the constant values
you're looking for.

PS > $type = [System.Environment+SpecialFolder]
PS > [enum]::getNames($type) | select @{n="Name";e={$_}},@{n="Value";e={$type::$_.value__}},@{n="Constant";e={"0x{0:X}
" -f $type::$_.value__}} | ft -a

Name Value Constant
---- ----- --------
Desktop 0 0x0
Programs 2 0x2
Personal 5 0x5
MyDocuments 5 0x5
Favorites 6 0x6
Startup 7 0x7
Recent 8 0x8
SendTo 9 0x9
StartMenu 11 0xB
MyMusic 13 0xD
DesktopDirectory 16 0x10
MyComputer 17 0x11
Templates 21 0x15
ApplicationData 26 0x1A
LocalApplicationData 28 0x1C
InternetCache 32 0x20
Cookies 33 0x21
History 34 0x22
CommonApplicationData 35 0x23
System 37 0x25
ProgramFiles 38 0x26
MyPictures 39 0x27
CommonProgramFiles 43 0x2B



---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar: http://tinyurl.com/PSToolbar



w> Thanks, Peter,
w>
w> for your reply in general and especially for the tip about using the
w> [System.Environment+SpecialFolder] enumeration to get the folder path
w> for a special folder. This enumeration provides access to 23 of the
w> 38 folder paths provided by the [ShellSpecialFolderConstants]
w> enumeration:
w>
w> [System.Environment+SpecialFolder] | Get-Member -Static -MemberType
w> Property
w>
w> Remains the question how to enumerate the
w> [ShellSpecialFolderConstants] properties from Powershell.
w>
w> wfr
w>
w> "Peter Schneider" <p.schneider@newsgroup> schrieb im Newsbeitrag
w> news:uquRMJ9pKHA.4532@newsgroup
w>

>> Hi!
>>
>> For enumerating the fonts you'd like to use something like this:
>>
>> [void]
>> [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
>> $objFonts = New-Object System.Drawing.Text.InstalledFontCollection
>> $objFonts.Families
>>
>> To get the folder path for a special folder use:
>> [System.Environment]::GetFolderPath([System.Environment+SpecialFolder
>> ]::Favorites)
>> greetings, Peter
>>
>> "wfr" <wfritz@newsgroup> schrieb im Newsbeitrag
>> news:OxZKdZrpKHA.5840@newsgroup
>>

>>> The MSDN page
>>> http://msdn.microsoft.com/en-us/libr...96(VS.85).aspx
>>> documents the ShellSpecialFolderConstants enumerated type that
>>> assigns name to the unique, system-independent values for a wide
>>> range of Windows' special folders.
>>>
>>> I know how to use these constants in conjunction with the
>>> Shell.Application
>>> to get at items in special folders:
>>> $shell = New-Object -ComObject Shell.Application
>>> $shell.NameSpace(0x14).Items() | % {$_.Name}
>>> I would be interested to learn how to reference the
>>> ShellSpecialFolderConstants
>>> enumeration directly in a Powershell expression,i.e. something like:
>>> $shell.NameSpace([ShellSpecialFolderConstants]::ssfFONTS).Items() |
>>> % {$_.Name}
>>>
>>> Any help is appreciated.
>>>
>>> P.S.
>>> I could create my own ShellSpecialFolderConstants
>>> enumeration from the MSDN documentation, but this is not point here:
>>> #>
>>> Add-Type @'
>>> public enum ShellSpecialFolderConstants
>>> {
>>> ssfALTSTARTUP = 0x1d,
>>> ssfAPPDATA = 0x1a,
>>> ssfBITBUCKET = 0x0a,
>>> ssfCOMMONALTSTARTUP = 0x1e,
>>> ssfCOMMONAPPDATA = 0x23,
>>> ssfCOMMONDESKTOPDIR = 0x19,
>>> ssfCOMMONFAVORITES = 0x1f,
>>> ssfCOMMONPROGRAMS = 0x17,
>>> ssfCOMMONSTARTMENU = 0x16,
>>> ssfCOMMONSTARTUP = 0x18,
>>> ssfCONTROLS = 0x03,
>>> ssfCOOKIES = 0x21,
>>> ssfDESKTOP = 0x00,
>>> ssfDESKTOPDIRECTORY = 0x10,
>>> ssfDRIVES = 0x11,
>>> ssfFAVORITES = 0x06,
>>> ssfFONTS = 0x14,
>>> ssfHISTORY = 0x22,
>>> ssfINTERNETCACHE = 0x20,
>>> ssfLOCALAPPDATA = 0x1c,
>>> ssfMYPICTURES = 0x27,
>>> ssfNETHOOD = 0x13,
>>> ssfNETWORK = 0x12,
>>> ssfPERSONAL = 0x05,
>>> ssfPRINTERS = 0x04,
>>> ssfPRINTHOOD = 0x1b,
>>> ssfPROFILE = 0x28,
>>> ssfPROGRAMFILES = 0x26,
>>> ssfPROGRAMFILESx86 = 0x30,
>>> ssfPROGRAMS = 0x02,
>>> ssfRECENT = 0x08,
>>> ssfSENDTO = 0x09,
>>> ssfSTARTMENU = 0x0b,
>>> ssfSTARTUP = 0x07,
>>> ssfSYSTEM = 0x25,
>>> ssfSYSTEMx86 = 0x29,
>>> ssfTEMPLATES = 0x15,
>>> ssfWINDOWS = 0x24
>>> };
>>> '@
>>> [ShellSpecialFolderConstants] | Get-Member -Static
>>>
>>> $shell.NameSpace([ShellSpecialFolderConstants]::ssfFONTS).Items() |
>>> % {$_.Name}
>>>