PSReadLine set the syntax highlighting to the PowerShell console
Owners windows 10 can enjoy syntax highlighting in PowerShell console. In previous versions of the lights will not appear even if you set WMF5. It is implemented by the module PSReadLine. This module allows you to do different highlighting like Emacs or Vim, add commands, etc., adds search history, private shotkaty, etc describes how to install the backlight in the PowerShell console for previous versions of windows.
1. the installation on Win 8.1 and 2012R2 if You have already installed WMF5
The first thing to do is to download the backlight module from the repository OneGet cmdlet Find-Package if it is not used it will ask to download and install package Manager NuGet
Led team below, all questions are answered in the affirmative.
the

the presence of OneGet much easier life
2. installation in Win 8.1 with PowerShell 4
need to download the PSReadLine.zip from GitHub.
after check whether the removed lock with the downloaded file (otherwise you may get an error when trying to run the script), to do this, open the file properties and if there is a button "unblock" click it

it's just a module, then act as if you are installing any module, copy it into your \ modules folder. If you have not created such a folder then create it
the
installing PSReadLine
to install run console under administrator
set the permissions for the execution of scripts
then import the module
the
if you do not see the error messages so everything is done correctly and the module start
last, you can add automatic import of the module each time you start the console
to do this, add an import command in your profile. Because the module for PS4 does not work well in the PowerShell ISE it is recommended to leave the import-only console. for PowerShell 5 this is not a problem, the module works in ISE without error.
the
Now you can enter Get-PSReadlineKeyHandler and see what shotkaty defined by default
Article based on information from habrahabr.ru
1. the installation on Win 8.1 and 2012R2 if You have already installed WMF5
The first thing to do is to download the backlight module from the repository OneGet cmdlet Find-Package if it is not used it will ask to download and install package Manager NuGet
Led team below, all questions are answered in the affirmative.
the
Find-Package PSReadLine
Install-Module PSReadLine
Import-Module PSReadLine

the presence of OneGet much easier life
2. installation in Win 8.1 with PowerShell 4
need to download the PSReadLine.zip from GitHub.
after check whether the removed lock with the downloaded file (otherwise you may get an error when trying to run the script), to do this, open the file properties and if there is a button "unblock" click it

it's just a module, then act as if you are installing any module, copy it into your \ modules folder. If you have not created such a folder then create it
the
cp $env:USERPROFILE\Downloads\PSREadline\* $env:USERPROFILE\Documents\WindowsPowerShell\Modules\PSReadLine\
installing PSReadLine
to install run console under administrator
set the permissions for the execution of scripts
then import the module
the
Import-Module PSReadLine
if you do not see the error messages so everything is done correctly and the module start
last, you can add automatic import of the module each time you start the console
to do this, add an import command in your profile. Because the module for PS4 does not work well in the PowerShell ISE it is recommended to leave the import-only console. for PowerShell 5 this is not a problem, the module works in ISE without error.
the
if ($host.Name-eq 'ConsoleHost')
{
Import-Module PSReadLine
}
Now you can enter Get-PSReadlineKeyHandler and see what shotkaty defined by default
Комментарии
Отправить комментарий