forked from jdhitsolutions/PSScriptTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocations.ps1
More file actions
35 lines (29 loc) · 827 Bytes
/
Copy pathLocations.ps1
File metadata and controls
35 lines (29 loc) · 827 Bytes
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
<#
need an easy way to determine certain locations depending on whether you
are running Windows or Linux
TEMP
HOME (or DOCUMENTS?)
DESKTOP
PowerShell (location of $profile)
#>
Function Get-PSLocation {
[cmdletbinding()]
Param()
if ($profile) {
$ps = Split-Path $profile
}
elseif ($IsCoreCLR) {
$ps = Split-Path (pwsh -noprofile -nologo {$profile})
}
else {
$ps = Split-Path (powershell -noprofile -nologo {$profile})
}
[PSCustomObject]@{
PSTypename = "psLocation"
Home = [Environment]::GetFolderPath([Environment+SpecialFolder]::MyDocuments)
Temp = [system.io.path]::GetTempPath()
Desktop = [environment]::GetFolderPath("Desktop")
PowerShell = $ps
PSHome = $PSHome
}
} #close Get-PSLocation