2011-12-29 90 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

相關問題