Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Powershell Capture Result  (Read 4187 times)

0 Members and 1 Guest are viewing this topic.

et_phonehome_2

    Topic Starter


    Beginner

    Thanked: 2
    Powershell Capture Result
    « on: August 02, 2014, 04:49:29 PM »
    PS C:\> $a = [string]"This string contains a number of letters"
    PS C:\> $a -match 'a number'
    True

    How would I capture the resultant value of "True" in a variable from match?

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: Powershell Capture Result
    « Reply #1 on: August 02, 2014, 06:17:50 PM »
    Couple of ways, this might be the easiest:

    Code: [Select]
    $a = [string]"This string contains a number of letters"
    $result = $a -match 'a number'
    $result

     8)

    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein