File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1078,3 +1078,33 @@ filter Format-Hashtable {
10781078
10791079 return $lines -join [Environment ]::NewLine
10801080}
1081+
1082+ function Add-PSModulePath {
1083+ <#
1084+ . SYNOPSIS
1085+ Adds a path to the PSModulePath environment variable.
1086+
1087+ . DESCRIPTION
1088+ Adds a path to the PSModulePath environment variable.
1089+ For Linux and macOS, the path delimiter is ':' and for Windows it is ';'.
1090+
1091+ . EXAMPLE
1092+ Add-PSModulePath -Path 'C:\Users\user\Documents\WindowsPowerShell\Modules'
1093+
1094+ Adds the path 'C:\Users\user\Documents\WindowsPowerShell\Modules' to the PSModulePath environment variable.
1095+ #>
1096+ [CmdletBinding ()]
1097+ param (
1098+ # Path to the folder where the module source code is located.
1099+ [Parameter (Mandatory )]
1100+ [string ] $Path
1101+ )
1102+ $PSModulePathSeparator = [System.IO.Path ]::PathSeparator
1103+
1104+ $env: PSModulePath += " $PSModulePathSeparator$Path "
1105+
1106+ Write-Verbose ' PSModulePath:'
1107+ $env: PSModulePath.Split ($PSModulePathSeparator ) | ForEach-Object {
1108+ Write-Verbose " - [$_ ]"
1109+ }
1110+ }
You can’t perform that action at this time.
0 commit comments