:: Windows/Linux Sys Admin :: PowerShell Evangelist :: My fascination with scripting started with AWK and has evolved into PowerShell-fanatic.
2009-05-18
welllll, isn't that Special...(Folders)
I was building a Batch script to push out a desktop shortcut to workstations on our domain via SMS. I ran into some issues with the %ALLUSERSPROFILE% environment variable reading from the server environment versus the local workstation environment. Anyhow, I stumbled across the .NET class Environment which provides a static method named GetFolderPath().
List Special Folders...
[environment+specialfolder]::GetNames([environment+specialfolder])
Desktop
Programs
Personal
MyDocuments
Favorites
Startup
Recent
SendTo
StartMenu
MyMusic
DesktopDirectory
MyComputer
Templates
ApplicationData
LocalApplicationData
InternetCache
Cookies
History
CommonApplicationData
System
ProgramFiles
MyPictures
CommonProgramFiles
Retreiving specific Special Folders...
$myDocuments = [Environment]::GetFolderPath("MyDocuments")
Once you've defined the variable you can then reuse it...
get-childitem $myDocuments
Mode LastWriteTime Length Name
---- ------------------ ------ ----
d---- 5/3/2009 7:47 PM folder1
2009-05-04
Script Center Survey (Spring 2009)
The good folks at the Microsoft Script Center have a link posted to collect your opinions on their site's resources, get your suggestions, and your thoughts on PowerShell.
http://www.surveymonkey.com/s.aspx?sm=v1G4SNMGKvH3M9Mf0IPBNQ_3d_3d
Hey Scripting Guys...Thanks for asking!
http://www.surveymonkey.com/s.aspx?sm=v1G4SNMGKvH3M9Mf0IPBNQ_3d_3d
Hey Scripting Guys...Thanks for asking!
Subscribe to:
Posts (Atom)