Skip to content

Instantly share code, notes, and snippets.

@whoisj
Last active September 17, 2018 17:56
Show Gist options
  • Save whoisj/1c361a9a0d6bf7025f9a3ad85d0f2bbf to your computer and use it in GitHub Desktop.
Save whoisj/1c361a9a0d6bf7025f9a3ad85d0f2bbf to your computer and use it in GitHub Desktop.
PowerShell profile (local)
function prompt
{
"[$(get-location) $(Get-Date -Format "HH:mm:ss")]> "
}
# Show elapsed time for last N commands
function global:DisplayCommandTimes
{
$count = if ($args[0]) { $args[0] } else { 5 }
Get-History -Count $count |
% { $_ | Add-Member -PassThru Elapsed ($_.EndExecutionTime - $_.StartExecutionTime).ToString('c') } |
Format-Table Elapsed, CommandLine
}
set-alias -name 'times' -scope 'global' -value global:DisplayCommandTimes -force -option allscope
# Show elapsed time for last N commands
function times
{
$count = if ($args[0]) { $args[0] } else { 5 }
Get-History -Count $count |
% { $_ | Add-Member -PassThru Elapsed ($_.EndExecutionTime - $_.StartExecutionTime).ToString('c') } |
Format-Table Elapsed, CommandLine
}
function global:OpenEditor {
start-process 'C:\Program Files\Notepad++\notepad++.exe' "-multiInst -nosession -noPlugin $args"
}
set-alias -name 'edit' -scope 'global' -value global:OpenEditor
function global:DiffFiles {
if ($args.Length -gt 1) {
start-process 'C:\Program Files\Beyond Compare 4\BCompare.exe' "$args"
}
}
set-alias -name 'diff' -scope 'global' -value global:DiffFiles -force -option allscope
cd D:\Src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment