Windows PowerShell


Windows PowerShell , formerly Microsoft Command Shell (MSH), code-named Monad , is asoftware suitedeveloped byMicrosoftthat includes acommand-line interface, thescripting language PowerShelland adevelopment kit. It is included inWindows 7andWindows 10(including consumerversions) and builds on theMicrosoft .NET Framework.

Originally, Windows PowerShell was expected to be included in Windows Vista , but eventually the two software were disjointed. Microsoft released a beta version on September 11, 2005, a Release Candidate 1 on April 25, 2006, and a Release Candidate 2 on September 26, 2006. The final release was released on November 14, 2006. Windows PowerShell is also included in Microsoft Exchange Server 2007 , Released in the fourth quarter of 2006, as well as most of the Microsoft products released since.

Windows PowerShell is compatible with all versions of Windows that support .NET version 2.0.

Since March 24, 2009, Windows PowerShell 1.0 for Windows XP and Vista is distributed as an optional software update by Microsoft Windows Update Service. It is natively integrated in Windows 7 in version 2.0 1 . This release includes a built-in scripting console called Windows PowerShell ISE (Integrated Scripting Environment) that provides an alternative to the PowerGUI Script Editor tool developed by Quest Software . As its counterpart Windows PowerShell ISE presents a graphical environment that allows script editing with syntax highlighting, displaying line numbers,

Since Windows 8 , PowerShell has a more prominent place within the operating system with a shortcut in all the windows of File Explorer , from the File menu 2 .

History

Windows PowerShell is the successor of the DOS / Windows command-line interfaces provided by

  • Command.com (ie the MS-DOS interface ) of Windows Me , Windows 98 and its predecessors;
  • Cmd.exe from Windows NT since 1993.

One can also mention the Windows Scripting Host (WSH), which was introduced in 1998, which has had some success with administrators but does not allow interactive use: scripts can be called from the command line, but they must first be saved in a file.

None of these interfaces conforms to POSIX 2 (POSIX is a standard made for Unix shells which are not object oriented but rather text stream to be decomposed and interpreted).

Comparison of Windows PowerShell and UNIX scripting languages

At the base influenced by the Tcl 3 language , PowerShell is closer to object-oriented scripting languages ​​like Perl than shell languages , such as Bash . There is no resemblance between the PowerShell and the batch language of the DOS / Windows .BAT files.

The goal of Microsoft is to make a fully integrated scripting language, with as many features as exist under Unix (and Linux ) and with the same level of security.

On the other hand, exchanges between components are made in the form of objects and not of text:

  • On UNIX exchanges are made in the form of a tube in the form of a byte stream often interpreted between the input of a component and the output of a component.
  • Conversely, with Windows PowerShell, exchanges are made in object format. Windows PowerShell provides command line access to .NET libraries .
PowerShell (Cmdlet) PowerShell (Alias) CMD.EXE / COMMAND.COM Shell Unix Description
Get-ChildItem Gci, dir, ls Dir Ls Lists directory files / directories (current)
Get-Content Gc, type, cat type Cat Get the contents of a file
Get-Command Gcm Help Help , which List of commands
Get-Help Help, man Help Man Help
Clear-Host Cls, clear Cls Clear Clear screen
Copy-Item Cpi, copy, cp Copy Pc Copy one or more files / the complete tree
Move-Item Mi, move, mv Move Mv (Unix) Move a file / directory
Remove-Item Ri, del, erase, rmdir, rd, rm Del, deltree , erase, rmdir , rd Rm , rmdir Delete a file / directory
Rename-Item Rni, ren, mv Ren , Rename Mv (Unix) Rename a file / directory
Get-Location Gl, pwd CD Pwd Show current working directory
Pop-Location Popd Popd Popd Change the current directory to the most recently pushed directory on the stack
Push-Location Pushd Pushd Pushd Push the current directory on the stack
Set-Location Sl, cd, chdir Cd , chdir CD Change the current directory
Tee-Object Tee NC Tee Direct the entry to a file or variable, and then pass it into a pipeline
Write-Output Echo, write echo echo Display strings, variables etc on standard output
Get-Process Gps, ps Tlist Ps List of all running processes
Stop-Process Spps, kill Kill Kill Stop a running process
Select-String Sls, findstr Find, findstr Grep Searching for a String
Set-Variable Sv set set Env, export, set, setenv Define the value of a variable / create a variable
Invoke-WebRequest Iwr NC Wget , cURL Gets the contents of a web page

Origin of the code name

The code name Monad comes from the book Monadology of the philosopher Leibniz : he affirms that reality is composed of fundamental elements called monads , which are integrated together in a pre- established harmony.

Similarly, Windows PowerShell consists of a series of tasks performed by a series of components. In the present case, these components are called commandlets ( abbreviated in cmdlets in the command console), we also meet the anglicism commandlets .

Benefits

PowerShell allows you to manage strings with 16-bit units, as is done on Windows, .NET, Java and JavaScript platform.

Limitations

PowerShell can not display Unicode characters when used through Windows console subsystem . A workaround to do this is to use the PowerShell Integrated Scripting Environment, a GUI 4 .

List of internal commands

Main article: PowerShell .

Notes and references

  1. ↑ What’s new in Windows PowerShell in Windows 7  [ archive ] .
  2. ↑ The explorer menu in Windows 8  [ archive ] .
  3. ↑ Jeffrey Snover, Windows PowerShell: PowerShell and WPF: WTF  [ archive ] .
  4. ↑ http://stackoverflow.com/questions/5796339/printing-unicode-characters-to-powershell-prompt  [ archive ] .