MSH: Various Aliases and Functions

I find these aliases and "goto directory" functions pretty handy in my Microsoft Command Shell:

# ———————————————————————
# Configure aliases
# ———————————————————————
set-alias ci copy-item
set-alias measure measure-object

# ———————————————————————
# Configure alias functions
# ———————————————————————
remove-item alias:dir -ea SilentlyContinue
function dir  { get-childitem $args |
                sort @{e={$_.MshIsContainer}; asc=$false},@{e={$_.Name}; asc=$true} }
function dirw { get-childitem $args |
                sort @{e={$_.MshIsContainer}; asc=$false},@{e={$_.Name}; asc=$true} |
                format-wide }
function dirs { get-childitem $args | sort Length -descending }
function dirt { get-childitem $args | sort LastWriteTime -descending }
function dird { get-childitem $args | where { $_.MshIsContainer } }
function e    { notepad2 $args }
function ep   { notepad2 "$Profile" }
function ff   { match-string -fullname C:\Filelist.txt -pattern $args | foreach { $_.Line }}
function vars { get-variable | sort Name }

# Location "aliases"
function gb  { cd C:\Bin }
function gh  { cd "$Home" }
function gt  { cd "$env:Temp" }
function gw  { cd "$env:SystemRoot" }
function gac { cd "$env:SystemRoot\Assembly\GAC" }
function gfx { cd "$([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())" }
function gs  { cd "$env:SystemRoot\system32" }
function gl  { cd "$env:SystemRoot\system32\LogFiles" }
function gcf { cd "$env:CommonProgramFiles" }
function gpf { cd "$env:ProgramFiles" }
function gwr { cd "$env:SystemDrive\inetpub\wwwroot" }
function gmd { cd "$env:USERPROFILE\My Documents"}
function gvs { cd "${env:VS80COMNTOOLS}..\.." }

function cw { attrib -R $args }
function cr { attrib +R $args }

Advertisements
This entry was posted in Monad. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s