This blog has moved to http://ThePowerShellGuy.com
Greetings /\/\o\/\/
I did think of this function a while ago but this did not work in Beta 2,
There used to be a bug where MSH wouldn't find nested types (note the + sign)
[enum]::getnames([System.Environment+SpecialFolder])
this Enum is used by [Environment]::GetFolderPath to get the Path of a special folder.
so with a small function like this :
function get-SpecialFolder {
param([System.Environment+SpecialFolder]$Alias)
[Environment]::GetFolderPath([System.Environment+SpecialFolder]$alias)
}
you can now easy get a path to a special folder.
MSH>get_SpecialFolder history
C:\Documents and Settings\mow\Local Settings\History
if it does not exist you get a list of possibel values (by converting it in the parms section.
MSH>get_SpecialFolder foo
get_SpecialFolder : Cannot convert "foo" to "System.Environment+SpecialFolder" due to invalid enumeration values. The possible enumerationvalues are "Desktop, Programs, Personal, MyDocuments, Favorites, Startup, Recent, SendTo, StartMenu, MyMusic, DesktopDirectory, MyComputer, Templates, ApplicationData, LocalApplicationData, InternetCache, Cookies, History, CommonApplicationData, System, ProgramFiles, MyPictures, CommonProgramFiles"
.At line:1 char:18+ get_SpecialFolder <<<< foo
gr /\/\o\/\/
Tags : Monad msh