• subscribe
March 27, 2008 12:00 AM

PowerShell 101, Lesson 3

How to use PowerShell's operators and wildcards
Windows IT Pro
InstantDoc ID #98177

Arithmetic Operators
PowerShell supports the use of arithmetic operators to perform mathematical calculations. Table 4 describes the operators and provides basic examples. In addition to using the operators for mathematical calculations, you can use some of the operators other ways. For example, you can use the + operator to concatenate string values:

“Use + to add two” +
  “ “ + “strings together.”

Figure 6 shows the results of concatenating these two values. This figure also shows the results for the statement:

 “abc” * 4

In this case, the * operator is used to multiply a string value four times. As a result, four copies of the value are returned, and those values are concatenated into one string.

My arithmetic-operator examples are very basic. As you work through the lessons, you’ll see more complex examples of how these operators can be used. This section is meant only to introduce you to the arithmetic operators so that you can begin to use them. To learn more about these types of operators, see the about_arithmetic_operators Help file.

Moving Forward
In this lesson, you learned that PowerShell supports a number of operators that let you create expressions and perform calculations. However, this lesson doesn’t cover all operators. For example, PowerShell also supports bitwise operators that perform binary operations and assignment operators that assign values to variables. I’ll be covering many of these operators as we progress through the lessons. In the meantime, refer to the Power-Shell Help files to learn more about the available operators.



ARTICLE TOOLS

Comments
  • Gebremeskel
    2 years ago
    Jan 07, 2010

    It is a great start

  • crjo
    4 years ago
    Apr 22, 2008

    Very good articles

  • Mike
    4 years ago
    Apr 17, 2008

    I'm not sure what to make of this...

    Figure 5 is supposed to return all non-Microsoft processes.

    I know that the CSRSS process was purchased from Citrix a few years ago and probably not recoded by Microsoft, but why in the world would the System and WINLOGON processes be listed as non-Microsoft?

You must log on before posting a comment.

Are you a new visitor? Register Here