Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .