Skip to content

Instantly share code, notes, and snippets.

@rpalo
Created April 7, 2018 15:21

Revisions

  1. rpalo created this gist Apr 7, 2018.
    35 changes: 35 additions & 0 deletions profile-example.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    # Microsoft.PowerShell_profile.ps1

    # You can customize the window itself by accessing $Host.UI.RawUI
    $window = $Host.UI.RawUI
    $window.WindowTitle = "Pa-pa-pa-pa-pa-pa-POWERSHELL"
    $window.BackgroundColor = "Black"
    $window.ForegroundColor = "Gray"

    # You can define functions (remember to follow the Verb-Noun convention!)
    function Count-History {
    (Get-History | Measure-Object).count
    }

    function beep {
    echo `a
    }

    function Edit-Profile {
    [CmdletBinding()]
    [Alias("ep")]
    PARAM()

    vim $profile
    }

    # You can set aliases
    # NOTE: In PowerShell you can only alias simple commands. Unlike Bash,
    # you can't alias commands with arguments flags. If you want to do that
    # you should define a function instead.
    Set-Alias touch New-Item # old habits die hard, amirite?

    # You can customize your prompt!
    function prompt {
    # ... see the next section for more details on this.
    }