2011-12-29 95 views
18

我是PowerShell的新手,我正在努力应对这个简单的操作—我试图从命令行启动一个PowesShell窗口。如何从命令行启动PowerShell(不是脚本)

如果我启动命令行实例并键入powershellstart powershell,我将在命令行界面中获取PowerShell实例,即带有白色文本的典型黑色背景。我想为典型的PowerShell界面启动—带白色文本的蓝色背景?我正在运行安装了PowerShell 2.0的Windows   XP。

回答

15

设置默认的控制台颜色和字体:

http://poshcode.org/2220
从Windows PowerShell中食谱(O'Reilly出版)
勒e 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 
29

如果你去C:\Windows\system32\Windowspowershell\v1.0(和C:\Windows\syswow64\Windowspowershell\v1.0在x64机器上)在Windows资源管理器,双击powershell.exe你会看到它打开PowerShell和黑色的背景。从开始菜单打开时,PowerShell控制台显示为蓝色,因为可以独立于默认属性设置powershell.exe的快捷方式的控制台属性。

要设置默认选项,字体,颜色和布局,请打开PowerShell控制台,输入Alt-Space,然后选择Defaults菜单选项。

从cmd.exe运行start powershell应该使用默认设置启动一个新控制台。

+0

感谢您指向'属性'选项。 – Rick 2012-07-01 02:25:33

11

颜色和窗口大小由快捷键LNK文件定义。我想我找到了一种方法,将你需要的东西,试试这个:

​​

的LNK文件是在位于不同地点的所有用户开始菜单取决于你是否在XP或Windows 7。7该LNK文件是在这里:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Windows PowerShell 
+1

太棒了!如果右键单击并选择属性,则可以看到.lnk如何存储所有属性。 – 2013-04-29 14:52:00

相关问题