Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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