I am new to PowerShell and am struggling with what I assume should be a simple operation—I am trying to launch a PowesShell window from the command line.
我是PowerShell的新手,我正在努力解决我认为应该是一个简单的操作 - 我试图从命令行启动一个PowesShell窗口。
If I launch a command line instance and type either powershell
or start powershell
, I am getting a PowerShell instance within the command line interface, i.e. the typical black background with white text. What I would like is for the typical PowerShell interface to launch—blue background with white text? I am running Windows XP with PowerShell 2.0 installed.
如果我启动一个命令行实例并键入powershell或start powershell,我将在命令行界面中获得一个PowerShell实例,即带有白色文本的典型黑色背景。我想要的是典型的PowerShell界面启动蓝色背景与白色文本?我正在运行安装了PowerShell 2.0的Windows XP。
3 个解决方案
#1
15
Set the default console colors and fonts:
设置默认控制台颜色和字体:
http://poshcode.org/2220
From Windows PowerShell Cookbook (O'Reilly)
by Lee Holmes (http://www.leeholmes.com/guide)
http://poshcode.org/2220来自Lee Holmes的Windows PowerShell Cookbook(O'Reilly)(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
#2
30
If you go to C:\Windows\system32\Windowspowershell\v1.0
(and C:\Windows\syswow64\Windowspowershell\v1.0
on x64 machines) in Windows Explorer and double-click powershell.exe
you will see that it opens PowerShell with a black background. The PowerShell console shows up as blue when opened from the start menu because the console properties for shortcuts to powershell.exe
can be set independently from the default properties.
如果在Windows资源管理器中转到C:\ Windows \ system32 \ Windowspowershell \ v1.0(以及x64计算机上的C:\ Windows \ syswow64 \ Windowspowershell \ v1.0)并双击powershell.exe,您将看到它打开PowerShell与黑色背景。从开始菜单打开时,PowerShell控制台显示为蓝色,因为可以独立于默认属性设置powershell.exe快捷方式的控制台属性。
To set the default options, font, colors and layout, open a PowerShell console, type Alt-Space, and select the Defaults menu option.
要设置默认选项,字体,颜色和布局,请打开PowerShell控制台,键入Alt-Space,然后选择“默认”菜单选项。
Running start powershell
from cmd.exe should start a new console with your default settings.
从cmd.exe运行启动powershell应该使用默认设置启动新控制台。
#3
11
The color and window sizing are defined by the shortcut LNK file. I think I found a way that will do what you need, try this:
颜色和窗口大小由快捷方式LNK文件定义。我想我找到了一种可以满足您需求的方法,试试这个:
explorer.exe "Windows PowerShell.lnk"
The LNK file is in the all user start menu which is located in different places depending whether your on XP or Windows 7. In 7 the LNK file is here:
LNK文件位于所有用户开始菜单中,根据您的XP或Windows 7,它位于不同的位置。在7中,LNK文件位于:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Windows PowerShell
#1
15
Set the default console colors and fonts:
设置默认控制台颜色和字体:
http://poshcode.org/2220
From Windows PowerShell Cookbook (O'Reilly)
by Lee Holmes (http://www.leeholmes.com/guide)
http://poshcode.org/2220来自Lee Holmes的Windows PowerShell Cookbook(O'Reilly)(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
#2
30
If you go to C:\Windows\system32\Windowspowershell\v1.0
(and C:\Windows\syswow64\Windowspowershell\v1.0
on x64 machines) in Windows Explorer and double-click powershell.exe
you will see that it opens PowerShell with a black background. The PowerShell console shows up as blue when opened from the start menu because the console properties for shortcuts to powershell.exe
can be set independently from the default properties.
如果在Windows资源管理器中转到C:\ Windows \ system32 \ Windowspowershell \ v1.0(以及x64计算机上的C:\ Windows \ syswow64 \ Windowspowershell \ v1.0)并双击powershell.exe,您将看到它打开PowerShell与黑色背景。从开始菜单打开时,PowerShell控制台显示为蓝色,因为可以独立于默认属性设置powershell.exe快捷方式的控制台属性。
To set the default options, font, colors and layout, open a PowerShell console, type Alt-Space, and select the Defaults menu option.
要设置默认选项,字体,颜色和布局,请打开PowerShell控制台,键入Alt-Space,然后选择“默认”菜单选项。
Running start powershell
from cmd.exe should start a new console with your default settings.
从cmd.exe运行启动powershell应该使用默认设置启动新控制台。
#3
11
The color and window sizing are defined by the shortcut LNK file. I think I found a way that will do what you need, try this:
颜色和窗口大小由快捷方式LNK文件定义。我想我找到了一种可以满足您需求的方法,试试这个:
explorer.exe "Windows PowerShell.lnk"
The LNK file is in the all user start menu which is located in different places depending whether your on XP or Windows 7. In 7 the LNK file is here:
LNK文件位于所有用户开始菜单中,根据您的XP或Windows 7,它位于不同的位置。在7中,LNK文件位于:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Windows PowerShell