I'm running Win7 and have Powershell docked on my taskbar. When I launch it from there, it retains all of my color and font settings from the last time I used it. I have two questions. First, if I try to run PS from a batch script just by using:

powershell

it will launch with all of the system default settings (white on black, tiny text).

Second, what do I need to add to the command to launch PS and have it start in a specific directory?

link|improve this question

80% accept rate
feedback

1 Answer

up vote 0 down vote accepted

You can view the current console properties with (Get-Host).UI.RawUI

To change them you can cut and paste this, for example:

$a = (Get-Host).UI.RawUI
$a.BackgroundColor = "white"
$a.ForegroundColor = "black"
Set-Location C:\foo
Clear-Host    

(You can actually copy the above script and paste it in directly, where it will execute line-by-line, which is a pretty cool thing about PowerShell)

If you save it to...

%USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

$home\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

...it will execute every time you start PowerShell in that user account.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.