Hi, Damian Garbus here and this is next Poshland blog post. Did you read my post about Powershell comparison operators? I have used there an example with Powershell wildcard symbol. In this post, I want to explain what are wildcard and how you can use it

What is it the Powershell wildcard?

The wildcard lets you compare twice object even you don’t know a part or entire of values. You must know about it if you want to write Powershell scripts. I like showing on my blog real-life examples. Readers write to me that my examples help to understand better Powershell. I believe that it will help you too.

I love pizza! And you? Let’s imagine the pizza menu. 🙂

The * wildcard will match zero or more characters.
When you read the menu in the pizza shop, you would like to find your favorite taste. Sometimes you will find more than pizza, eg.: spaghetti.
To search only pizza on the menu, you can replace all other characters than “pizza” by ” * “.

powershell wildcard

The ? wildcard will match a single character.
Sometimes you may want to find very similar values in the menu but differ only single characters. In this scenario, you can use ” ? “.

powershell wildcard

Conclusion


How you can see, this is very important to know topics about variable types, comparison operators and Powershell wildcards. It will help you dynamically compare the value in your Powershell script.

In the end, I have one question for you. What kind of task did you automated recently using Powershell? Please write below in comment space.

Get Access to Poshland Resources for FREE!!!

Signup now and receive an email once I publish new content.

I agree to have my personal information transfered to MailChimp ( more information )

I will never give away, trade or sell your email address. You can unsubscribe at any time.


Damian Garbus

Hi, My name is Damian. I'm Powershell geek. Also, I love to improve my productivity and yourself development. I connected Powershell and my productivity tricks and built this blog. You can find here how to learn Powershell and use this to improve your productivity. Enjoy.

    3 replies to "Powershell wildcard in pizza shop???"

    • […] Powershell wildcard in pizza shop??? […]

    • Michał

      Hej Damiam,
      Super pomysł na obrazowe uczenie programowania, czegoś takiego szukałem!
      Podzielę się swoją konstruktywną krytyką: koniecznie musisz poprawić angielski bo często zła gramatyka nie pozwala za pierwszym razem zrozumieć o co chodziło autorowi.

      Jeżeli chcesz chętnie pomogę zrobić poprawki przed lub po publikacji 😉 za darmo 😛

      Pozdr!
      MK

      • Damian Garbus

        Dziękuję 🙂 odezwę się via mail.

        Pozdrawiam.
        Damian.

Leave a Reply

Your email address will not be published.