[英]How to launch PowerShell (not a script) from the command line
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, ie the typical black background with white text. 如果我启动一个命令行实例并键入
powershell
或start powershell
,我将在命令行界面中获得一个PowerShell实例,即带有白色文本的典型黑色背景。 What I would like is for the typical PowerShell interface to launch—blue background with white text? 我想要的是典型的PowerShell界面启动蓝色背景白色文本? I am running Windows XP with PowerShell 2.0 installed.
我正在运行安装了PowerShell 2.0的Windows XP。
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. 如果在Windows资源管理器中转到
C:\\Windows\\system32\\Windowspowershell\\v1.0
(以及x64计算机上的C:\\Windows\\syswow64\\Windowspowershell\\v1.0
)并双击powershell.exe
您将看到它打开PowerShell与黑色背景。 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. 从开始菜单打开时,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运行
start powershell
应该使用默认设置启动新控制台。
Set the default console colors and fonts: 设置默认控制台颜色和字体:
http://poshcode.org/2220 http://poshcode.org/2220
From Windows PowerShell Cookbook (O'Reilly) 从Windows PowerShell Cookbook(O'Reilly)
by Lee Holmes (http://www.leeholmes.com/guide) 作者: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
The color and window sizing are defined by the shortcut LNK file. 颜色和窗口大小由快捷方式LNK文件定义。 I think I found a way that will do what you need, try this:
我想我找到了一种可以做你需要的方法,试试这个:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.