Scripts/GlobalConstants.ps1

<#
.SYNOPSIS
    This script sets several global constant variables.
#>


# Set the variables
@(
    @{
        Name    = "CARRIAGE_RETURN"
        Option  = "Constant"
        Value   = "`r"
        Scope   = "Global"
    },
    @{
        Name    = "CARRIAGE_RETURN_LINE_FEED"
        Option  = "Constant"
        Value   = "`r`n"
        Scope   = "Global"
    },
    @{
        Name    = "CLEAR_VALUE_FLAG"
        Option  = "Constant"
        Value   = "-ClearValue"
        Scope   = "Global"
    },
    @{
        Name    = "CRLF"
        Option  = "Constant"
        Value   = "`r`n"
        Scope   = "Global"
    },
    @{
        Name    = "LINE_FEED"
        Option  = "Constant"
        Value   = "`n"
        Scope   = "Global"
    },
    @{
        Name    = "PLAIN_TEXT_FILE_EXTENSIONS"
        Option  = "Constant"
        Value   = @(
            ".bat",
            ".csv",
            ".dat",
            ".log",
            ".txt"
        )
        Scope   = "Global"
    }
) | ForEach-Object {
    # Only set the variable if it currently does not exist
    if (!(Get-Variable -Name $_.Name -Scope $_.Scope -ErrorAction SilentlyContinue)) {
        Write-Verbose "Setting $($_.Scope) $($_.Option) variable '$($_.Name)'."
        Set-Variable -Name $_.Name -Option $_.Option -Value $_.Value -Scope $_.Scope
    }
}