about_Parsing - PowerShell


 

Describes how Windows PowerShell parses commands. (about_Parsing)

   
# TOPIC
about_parsing

# SHORT DESCRIPTION
Describes how Windows PowerShell parses commands.

# LONG DESCRIPTION
When you enter a command at the command prompt, Windows PowerShell
breaks the command text into a series of segments called tokens
and then determines how to interpret each one. For example, Windows
PowerShell breaks the following command into two tokens, "Write-Host"
and "book", and interprets each token separately:

Write-Host book

When processing a command, the Windows PowerShell parser operates
in expression mode or in argument mode:

- In expression mode, character string values must be contained in
quotation marks. Numbers not enclosed in quotation marks are treated
as numerical values (rather than as a series of characters).

- In argument mode, each value is treated as an expandable string
unless it begins with one of the following special characters: dollar
sign ($), at sign (@), single quotation mark ('), double quotation
mark ("), or an opening parenthesis (().

If preceded by one of these characters, the value is treated as a value
expression.

The following table provides several examples of commands processed in
expression mode and argument mode and the results produced by those
commands.

Example Mode Result
------------------ ---------- ----------------
2+2 Expression 4 (integer)
Write-Output 2+2 Argument "2+2" (string)
Write-Output (2+2) Expression 4 (integer)
$a = 2+2 Expression $a = 4 (integer)
Write-Output $a Expression 4 (integer)
Write-Output $a/H Argument "4/H" (string)

Every token can be interpreted as some kind of object type, such
as Boolean or string. Windows PowerShell attempts to determine the
object type from the expression. The object type depends on the
type of parameter a command expects and on whether Windows PowerShell
knows how to convert the argument to the correct type. The
following table shows several examples of the types assigned to
values returned by the expressions.

Example Mode Result
------------------ ---------- ---------------
Write-Output !1 argument "!1" (string)
Write-Output (!1) expression False (Boolean)
Write-Output (2) expression 2 (integer)

SEE ALSO
about_Command_Syntax

C:\Windows>powershell get-help about_Path_Syntax -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows 10, 8.1, 8, 7, Vista / Windows Server 2016, 2012, 2008
»»»» ColorConsole








Windows-10





Windows-10

... facebook.de
... Windows-10 FAQ
... Windows-10 Info


Become a Sponsor
... Your button here?





PowerShell: Describes how Windows PowerShell parses commands.

HTTP: ... PS_Windows/en/about_Parsing.htm
0.249
11902

Turn off the Windows Store in Windows 8.1 / 10, can I?

 /

I search for countdown watch, for breaks in Events, Conferences, Lectures and Meetings?

 /

Console command to see IP Address, how to on Windows 10/8.1/7?

 /

Versteckte Dateien und Ordner in Windows 10 anzeigen lassen?

 /

Windows 8 on screen keypad at startup, start page, log in excluding keyboard?

 /

Was ist Autodesk?

 /

Wozu IsMyHdOK, wenn es schon ähnliche HD-Test Programme gibt!

 /

How to hide the mouse pointer in Windows-10 while typing!

 /

How can I uninstall the ExperienceIndexOK?

 /

What is a Windows document?

 /

See all installed devices (scanners, printers)?

 /

Audio Devices, Sound and Playback in Windows 10!

 /