Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从命令行启动PowerShell(不是脚本)_Powershell_Powershell 2.0 - Fatal编程技术网

如何从命令行启动PowerShell(不是脚本)

如何从命令行启动PowerShell(不是脚本),powershell,powershell-2.0,Powershell,Powershell 2.0,我是PowerShell的新手,正在努力解决我认为应该是一个简单操作的问题——我正在尝试从命令行启动一个PowesShell窗口 如果启动命令行实例并键入powershell或start powershell,则在命令行界面中会得到一个powershell实例,即典型的黑底白字。我想让典型的PowerShell界面启动蓝色背景和白色文本?我正在运行安装了PowerShell 2.0的WindowsXP。如果您在Windows资源管理器中转到C:\Windows\system32\Windowsp

我是PowerShell的新手,正在努力解决我认为应该是一个简单操作的问题——我正在尝试从命令行启动一个PowesShell窗口


如果启动命令行实例并键入
powershell
start powershell
,则在命令行界面中会得到一个powershell实例,即典型的黑底白字。我想让典型的PowerShell界面启动蓝色背景和白色文本?我正在运行安装了PowerShell 2.0的WindowsXP。

如果您在Windows资源管理器中转到
C:\Windows\system32\Windowspowershell\v1.0
(以及
C:\Windows\syswow64\Windowspowershell\v1.0
,然后双击
PowerShell.exe
,您将看到它以黑色背景打开PowerShell。从“开始”菜单打开时,PowerShell控制台显示为蓝色,因为可以独立于默认属性设置到
PowerShell.exe
的快捷方式的控制台属性

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


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

颜色和窗口大小由快捷方式LNK文件定义。我想我找到了一种可以满足你需要的方法,试试这个:

explorer.exe "Windows PowerShell.lnk"
LNK文件位于所有用户的“开始”菜单中,该菜单位于不同的位置,具体取决于您是使用XP还是Windows 7。在7中,LNK文件如下:

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

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


来自Windows PowerShell Cookbook(O'Reilly)
李霍姆斯(http://www.leeholmes.com/guide)


令人惊叹的!如果右键单击并选择属性,则可以看到.lnk如何存储所有属性。
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