Mats codemix

Mats codemix

A little c#, a litte .NET and throw in some c++ and you get a nice Spaghetti

Mats codemix RSS Feed
 
 
 
 

Windows Special folders in powershell…

… or where is my wallpaper?

I wanted to edit the imagefile i had as windows desktop background so i wanted to find out the location of it. Excellent material for a powershell lession i thought.

So where are the special folders? Could it be here:

ls ([Environment]::GetFolderPath('MyPictures')

Found help about how to get windows special folders  here and here.

What is [environment+Specialfolder]? Looks like it’s an enum.

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
False    True     SpecialFolder                            System.Enum

So you can list all enum names like this.

A nice way to list all options for special folders is:

[environment+specialfolder]::GetNames([environment+specialfolder])
Desktop
Programs
Personal
MyDocuments
Favorites
Startup
…etc

Eventually i had to use the windows dialog and found out that the wallpaper was in:

 ([Environment]::GetFolderPath('ApplicationData') + "\mozilla\firefox\")

But i learned some new powershell.

Leave a Reply