-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet-SpecialFolderPath.ps1
More file actions
40 lines (39 loc) · 1.7 KB
/
Get-SpecialFolderPath.ps1
File metadata and controls
40 lines (39 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function Get-SpecialFolderPath {
<#
.SYNOPSIS
Retrieves the path of one of the "special" folders and returns it
.DESCRIPTION
Reads the environment for the special folders like 'Desktop'm 'Documents', etc. and returns the path as a string
.EXAMPLE
PS C:\> Get-SpecialFolder -FolderPath CommonDesktopDirectory
C:\Users\Public\Desktop
.INPUTS
[string]
[environment+specialfolder]
.OUTPUTS
[string]
.NOTES
It utilizes the [System.Environment+SpecialFolder] enum to select the correct folder names
AdminTools CommonVideos Personal
ApplicationData Cookies PrinterShortcuts
CDBurning Desktop ProgramFiles
CommonAdminTools DesktopDirectory ProgramFilesX86
CommonApplicationData Favorites Programs
CommonDesktopDirectory Fonts Recent
CommonDocuments History Resources
CommonMusic InternetCache SendTo
CommonOemLinks LocalApplicationData StartMenu
CommonPictures LocalizedResources Startup
CommonProgramFiles MyComputer System
CommonProgramFilesX86 MyDocuments SystemX86
CommonPrograms MyMusic Templates
CommonStartMenu MyPictures UserProfile
CommonStartup MyVideos Windows
CommonTemplates NetworkShortcuts
#>
[cmdletbinding()]
param(
[System.Environment+SpecialFolder]$FolderPath
)
[System.Environment]::GetFolderPath($FolderPath)
}