/\/\o\/\/ PowerShelled

This blog has moved to http://ThePowerShellGuy.com Greetings /\/\o\/\/
$AtomFeed = ("Atom.xml")
$PreviousItems = (" Filling Emty Properties in AD from MSH "," First Monad B3 impression and please help the scri... "," Monad Beta 3 is released ! "," Report MP3 count and size by User from MSH "," YMCK "," Hosting Iron Python in MSH. "," MSH How can I Determine Which Text has been Select... "," Monad(MSH) Beta 3 is getting closer "," Monad Beta 3 is Coming soon and I got a MVP award "," Adding a Simple AccesRule to a file ACL in MSH "," ")

Thursday, January 12, 2006


Get SpecialFolder Locations in Monad

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)


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 {

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 :

Blogger Sung Meister
I really cannot get used to that "+" syntax for accessing Enum types... But at least it's not as clunky or awkward of a syntax as using generics syntax in MSH...
Blogger /\/\o\/\/
I'm using Reflector, this helps as it shows the + syntax also.

gr /\/\o\/\/
Anonymous Anonymous
This comment has been removed by a blog administrator.
Post a Comment

<< Home


October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006  

$Links = ("PowerShell RC1 Docs"," PowerShell RC1 X86"," PowerShell RC1 X64"," Monad GettingStarted guide"," Monad Progamming Guide"," Monad SDK"," Monad videos on Channel 9"," MSH Community Workspace"," scripts.readify.net "," MonadSource"," www.reskit.net"," PowerShell Blog"," Under The Stairs"," computerperformance powershell Home"," proudlyserving"," MSH on wikipedia"," MSHWiki Channel 9"," Keith Hill's Blog"," Precision Computing"," PowerShell for fun"," MSH Memo (Japanese)"," monadblog")

find-blog -about "PowerShell","Monad" | out-Technorati.
find-blog -contains "","" | out-Technorati.
Web mow001.blogspot.com

This page is powered by Blogger. Isn't yours?