Useful PowerShell profile code

To check the location for your Powershell profile file, type $profile .
To reload your PowerShell profile, use & $profile .

Edit your PowerShell profile to set custom colors and console size as follow:

$host.UI.RawUI.BackgroundColor = ‘Gray’
$host.UI.RawUI.ForegroundColor = ‘Black’

$pshost = get-host
$pswindow = $pshost.ui.rawui

$newsize = $pswindow.buffersize
$newsize.height = 9000
$newsize.width = 140
$pswindow.buffersize = $newsize

$newsize = $pswindow.windowsize
$newsize.height = 65
$newsize.width = 140
$pswindow.windowsize = $newsize

# You’ll need a HOME variable defined as environment variable
cd $env:HOME

Clear-Host

Note 1: Credits go to StackOverflow, IT blogs and alike, sites that helped me with the code when searching for solutions.
Note 2: Be aware that when copy-pasting, the quotes and possibly other characters get messed up by WordPress, you’ll have to replace them.

Advertisements

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

%d bloggers like this: