Functions/Set-Mylocation.ps1
function Set-Mylocation { [CmdletBinding()] param ( [Parameter(Mandatory)] [ValidateSet("Git", "OneDrive", "WindowsPowershell")] [string] $Folder, [Parameter()] [switch] $OpenInExplorer ) switch ($Folder) { "Git" { $Path = "$([Environment]::GetFolderPath("UserProfile"))\Git" } "OneDrive" { $Path = $env:OneDrive } "WindowsPowershell" { $Path = "$([Environment]::GetFolderPath("MyDocuments"))\WindowsPowerShell" } } Set-Location $Path if($OpenInExplorer) { explorer.exe $Path } } |