Cómo iniciar PowerShell (no un script) desde la línea de comandos


Soy nuevo en PowerShell y estoy luchando con lo que supongo que debería ser una operación simple: estoy tratando de lanzar una ventana de PowesShell desde la línea de comandos.

Si lanzo una instancia de línea de comandos y escribo powershell o start powershell, obtengo una instancia de PowerShell dentro de la interfaz de línea de comandos, es decir, el típico fondo negro con texto blanco. Lo que me gustaría es que la interfaz típica de PowerShell se inicie: ¿fondo azul con texto blanco? Estoy ejecutando Windows XP con PowerShell 2.0 instalado.

Author: Peter Mortensen, 2011-12-29

3 answers

Establezca los colores y fuentes predeterminados de la consola:

Http://poshcode.org/2220
De Windows PowerShell Cookbook (O'Reilly)
de 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
 15
Author: Shay Levy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-12-29 18:18:36

Si va a C:\Windows\system32\Windowspowershell\v1.0 (y C:\Windows\syswow64\Windowspowershell\v1.0 en máquinas x64) en el Explorador de Windows y hace doble clic en powershell.exe verá que se abre PowerShell con un fondo negro. La consola de PowerShell aparece en azul cuando se abre desde el menú inicio porque las propiedades de la consola para los accesos directos a powershell.exe se pueden establecer independientemente de las propiedades predeterminadas.

Para establecer las opciones predeterminadas, la fuente, los colores y el diseño, abra una consola de PowerShell, escriba Alt-Space y seleccione el menú Predeterminados opcion.

Ejecutando start powershell desde cmd.exe debería iniciar una nueva consola con la configuración predeterminada.

 32
Author: Rynant,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-01-02 21:30:16

El color y el tamaño de la ventana están definidos por el acceso directo archivo LNK. Creo que he encontrado una manera que va a hacer lo que necesita, pruebe esto:

explorer.exe "Windows PowerShell.lnk"

El archivo LNK está en el menú inicio de todos los usuarios que se encuentra en diferentes lugares dependiendo de si su en XP o Windows 7. En 7 el archivo LNK está aquí:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Windows PowerShell
 11
Author: Andy Arismendi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-12-29 17:09:48