Functions/Set-Mylocation.ps1


function Set-Mylocation {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory)] [ValidateSet("Git", "OneDrive", "WindowsPowershell", "WindowsPowershellProgramFiles")] [string] $Folder,
        [Parameter()] [switch] $OpenInExplorer
    )


    switch ($Folder) {
        "Git" {
            $Path = "$([Environment]::GetFolderPath("UserProfile"))\Git"
        }
        "OneDrive" {
            $Path = $env:OneDrive
        }
        "WindowsPowershell" {
            $Path = "$([Environment]::GetFolderPath("MyDocuments"))\WindowsPowerShell"
        }
        "WindowsPowershellProgramFiles" {
            $Path = "$($env:ProgramFiles)\WindowsPowerShell"
        }
    }


    Set-Location $Path

    if($OpenInExplorer) {
        explorer.exe $Path
    }

}