我是PowerShell的新手,正在为我认为应该是简单的操作而苦恼—我正试图从命令行启动一个PowesShell窗口。
如果我启动一个命令行实例并输入 "powershell "或 "start powershell",我在命令行界面中得到一个PowerShell实例,即典型的黑色背景和白色文本。我想要的是典型的PowerShell界面启动—蓝色背景,白色文本?我正在运行Windows XP,安装了PowerShell 2.0。
如果你在Windows资源管理器中进入C:Windows\system32\Windowspowershell\v1.0
(和C:Windows\syswow64\Windowspowershell\v1.0
在x64机器上)并双击powershell.exe
你会看到它以黑色背景打开PowerShell。当从开始菜单打开时,PowerShell控制台显示为蓝色,因为powershell.exe
的快捷方式的控制台属性可以独立于默认属性设置。
要设置默认选项、字体、颜色和布局,请打开PowerShell控制台,输入Alt-Space,然后选择Defaults菜单选项。
从cmd.exe运行 "start powershell "应该可以用你的默认设置启动一个新的控制台。
设置默认的控制台颜色和字体:
http://poshcode.org/2220 摘自Windows PowerShell Cookbook (O'Reilly) 作者:Lee Holmes (http://www.leeholmes.com/guide)
Set-StrictMode -Version Latest
Push-Location
Set-Location HKCU:\Console
New-Item '.\%SystemRoot%_system32_WindowsPowerShell_v1.0_powershell.exe'
Set-Location '.\%SystemRoot%_system32_WindowsPowerShell_v1.0_powershell.exe'
New-ItemProperty . ColorTable00 -type DWORD -value 0x00562401
New-ItemProperty . ColorTable07 -type DWORD -value 0x00f0edee
New-ItemProperty . FaceName -type STRING -value "Lucida Console"
New-ItemProperty . FontFamily -type DWORD -value 0x00000036
New-ItemProperty . FontSize -type DWORD -value 0x000c0000
New-ItemProperty . FontWeight -type DWORD -value 0x00000190
New-ItemProperty . HistoryNoDup -type DWORD -value 0x00000000
New-ItemProperty . QuickEdit -type DWORD -value 0x00000001
New-ItemProperty . ScreenBufferSize -type DWORD -value 0x0bb80078
New-ItemProperty . WindowSize -type DWORD -value 0x00320078
Pop-Location