about_wildcards - PowerShell


 

Describes how to use wildcard characters in Windows PowerShell. (about_wildcards)

   
# TOPIC
about_Wildcards

# SHORT DESCRIPTION
Describes how to use wildcard characters in Windows PowerShell.

# LONG DESCRIPTION
In many cases, you will want to run a cmdlet against a group of
items rather than an individual item. For example, you might
want to locate all the files in the C:\Techdocs directory that have a
.ppt file name extension. If you were to run the following command, it
would return all the items in the directory:

Get-ChildItem c:\techdocs

The problem with this command is that you would have to visually
inspect all the documents listed in the directory to determine which
files use the .ppt file name extension. However, you can limit the items
that are returned by using wildcard characters in a cmdlet's parameters.
A wildcard character is a type of placeholder that allows you to search
unknown values in order to return specific results. The process of using
wildcard characters is sometimes referred to as "globbing". For example,
you can recast the previous example so that only .ppt files are
returned:

Get-ChildItem c:\techdocs\*.ppt

In this case, the asterisk (*) is used as a wildcard character to specify
that any characters can exist before the .ppt file name extension. Because
the file name extension is included, all files returned by the command must
have that file name extension, but the files can have any name. As a
result, only the files that you are looking for are returned.

Windows PowerShell supports several wildcard characters in addition to the
asterisk wildcard character.

Wildcard Description Example Match No match
-------- ------------------ -------- ----------------- --------
* Matches zero or a* A, ag, Apple banana
more characters

? Matches exactly ?n an, in, on ran
one character in
the specified
position

[ ] Matches a range [a-l]ook book, cook, look took
of characters

[ ] Matches specified [bc]ook book, cook hook
characters

Most cmdlets accept wildcard characters in some of their parameters. The
Help topic for each cmdlet describes which parameters, if any, permit
wildcard characters. For parameters in which wildcard characters are
accepted, their use is case insensitive. For example, ?n will return An,
an, In, in, On, and on.

You can also mix wildcard characters within a single parameter. For
example, suppose that you want to display all the .txt files in the
C:\Techdocs directory that begin with the letters a through l. You can use
the following command:

Get-ChildItem c:\techdocs\[a-l]*.txt

The command uses a range wildcard ([a-l]) to specify that the file name
should begin with the letters a through l. The command then uses the
asterisk wildcard character to provide a placeholder for any characters
between the first letter and the file name extension.

SEE ALSO
about_Language_Keywords

C:\Windows>powershell get-help about_Windows_PowerShell_2.0 -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 to use wildcard characters in Windows PowerShell.

HTTP: ... PS_Windows/en/about_wildcards.htm
0.156
13569

Programmsymbol für Desktop-OK nach Windows 10-Update verloren!

 /

How do I customize the logon screen background from Windows 10?

 /

How can i create a New-Folder in each explorer View?

 /

Den Windows-10 Computerschutz ändern, um Systemänderungen rückgängig zu machen?

 /

Open, Close, Drive, Eject DVD, USB, CD, BlueRay

 /

Wo kann ich die D-U-N-S Nummer (DUNS) abfragen?

 /

Is remote support also possible with Window-7 (Starter / Pro)?

 /

Switch user Save / Restore Desktop Icons and Windows!

 /

Direct Download free antivirus software for Windows from Microsoft (7,8,Vista,xp)!

 /

Where is the difference between favorites and Quick links?

 /

Taskkill with the Cmd.exe, how to use correct and useful with examples!

 /

Wie kann ich in Win-7 die Benutzerkontensteuerung einstellen, bzw. die Benachrichtigungshäufigkeit bei Programmen?

 /