Skip to content

Commit 70ce1d9

Browse files
davidsmatlaksdwheeler
authored andcommitted
fixed code sample, copyedits, style (#4070)
1 parent 1873d5d commit 70ce1d9

File tree

5 files changed

+169
-195
lines changed

5 files changed

+169
-195
lines changed
Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
ms.date: 06/09/2017
2+
ms.date: 3/28/2019
33
schema: 2.0.0
44
locale: en-us
55
keywords: powershell,cmdlet
@@ -16,69 +16,63 @@ Describes how to use wildcard characters in PowerShell.
1616

1717
Wildcard characters represent one or many characters. You can use them to
1818
create word patterns in commands. For example, to get all the files in the
19-
C:\\Techdocs directory that have a .ppt file name extension, type:
19+
`C:\Techdocs` directory with a `.ppt` file name extension, type:
2020

2121
```powershell
22-
Get-ChildItem c:\techdocs\*.ppt
22+
Get-ChildItem C:\Techdocs\*.ppt
2323
```
2424

25-
In this case, the asterisk (*) wildcard character represents any characters
26-
that appear before the .ppt file name extension.
25+
In this case, the asterisk (`*`) wildcard character represents any characters
26+
that appear before the `.ppt` file name extension.
2727

28-
PowerShell supports the following wildcard characters.
28+
PowerShell supports the following wildcard characters:
2929

3030
|Wildcard|Description |Example |Match |No Match|
3131
|--------|--------------------------|--------|-------------|--------|
32-
|* |Matches zero or more |a* |aA, ag, Apple|banana |
33-
| |characters | | | |
34-
| | | | | |
35-
|? |Matches exactly one |?n |an, in, on |ran |
36-
| |character in that position| | | |
37-
| | | | | |
38-
|[ ] |Matches a range of |[a-l]ook|book, cook, |took |
39-
| |characters | | look | |
40-
| | | | | |
41-
|[ ] |Matches the specified |[bc]ook |book, cook |hook |
42-
| |characters | | | |
43-
44-
You can include multiple wildcard characters in the same word pattern.
45-
For example, to find text files whose names begin with the letters "a"
46-
through "l", type:
32+
|* |Match zero or more characters | a* | aA, ag, Apple | banana |
33+
|? |Match one character in that position | ?n | an, in, on | ran |
34+
|[ ] |Match a range of characters | [a-l]ook | book, cook, look | took |
35+
|[ ] |Match specific characters | [bc]ook | book, cook | hook |
36+
37+
You can include multiple wildcard characters in the same word pattern. For
38+
example, to find text files with names that begin with the letters **a**
39+
through **l**, type:
4740

4841
```powershell
49-
Get-ChildItem c:\techdocs[a-l]*.txt
42+
Get-ChildItem C:\Techdocs\[a-l]*.txt
5043
```
5144

52-
Many cmdlets accept wildcard characters in parameter values. The
53-
Help topic for each cmdlet describes which parameters, if any, permit
54-
wildcard characters. For parameters in which wildcard characters are
55-
accepted, their use is case-insensitive.
45+
Many cmdlets accept wildcard characters in parameter values. The Help topic for
46+
each cmdlet describes which parameters accept wildcard characters. For
47+
parameters that accept wildcard characters, their use is case-insensitive.
5648

57-
You can also use wildcard characters in commands and script blocks, such as
58-
to create a word pattern that represents property values. For example, the
59-
following command gets services in which the ServiceType property value
60-
includes "Interactive".
49+
You can use wildcard characters in commands and script blocks, such as to
50+
create a word pattern that represents property values. For example, the
51+
following command gets services in which the **ServiceType** property value
52+
includes **Interactive**.
6153

6254
```powershell
63-
Get-Service | Where-Object {$_.ServiceType -like "*Interactive*"}
55+
Get-Service | Where-Object {$_.ServiceType -Like "*Interactive*"}
6456
```
6557

66-
In the following example, wildcard characters are used to find property
67-
values in the conditions of an If statement. In this command, if the
68-
Description of a restore point includes "PowerShell", the command adds the
69-
value of the CreationTime property of the restore point to a log file.
58+
In the following example, the `If` statement includes a condition that uses
59+
wildcard characters to find property values. If the restore point's
60+
**Description** includes **PowerShell**, the command adds the value of the
61+
restore point's **CreationTime** property to a log file.
7062

7163
```powershell
7264
$p = Get-ComputerRestorePoint
7365
foreach ($point in $p) {
7466
if ($point.description -like "*PowerShell*") {
75-
add-content -path C:\TechDocs\RestoreLog.txt "$($point.CreationTime)"
67+
Add-Content -Path C:\TechDocs\RestoreLog.txt "$($point.CreationTime)"
7668
}
7769
}
7870
```
7971

8072
## SEE ALSO
8173

82-
- [about_Language_Keywords](about_Language_Keywords.md)
83-
- [about_If](about_If.md)
84-
- [about_Script_Blocks](about_Script_Blocks.md)
74+
[about_Language_Keywords](about_Language_Keywords.md)
75+
76+
[about_If](about_If.md)
77+
78+
[about_Script_Blocks](about_Script_Blocks.md)
Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
ms.date: 06/09/2017
2+
ms.date: 3/28/2019
33
schema: 2.0.0
44
locale: en-us
55
keywords: powershell,cmdlet
@@ -16,69 +16,63 @@ Describes how to use wildcard characters in PowerShell.
1616

1717
Wildcard characters represent one or many characters. You can use them to
1818
create word patterns in commands. For example, to get all the files in the
19-
C:\\Techdocs directory that have a .ppt file name extension, type:
19+
`C:\Techdocs` directory with a `.ppt` file name extension, type:
2020

2121
```powershell
22-
Get-ChildItem c:\techdocs\*.ppt
22+
Get-ChildItem C:\Techdocs\*.ppt
2323
```
2424

25-
In this case, the asterisk (*) wildcard character represents any characters
26-
that appear before the .ppt file name extension.
25+
In this case, the asterisk (`*`) wildcard character represents any characters
26+
that appear before the `.ppt` file name extension.
2727

28-
PowerShell supports the following wildcard characters.
28+
PowerShell supports the following wildcard characters:
2929

3030
|Wildcard|Description |Example |Match |No Match|
3131
|--------|--------------------------|--------|-------------|--------|
32-
|* |Matches zero or more |a* |aA, ag, Apple|banana |
33-
| |characters | | | |
34-
| | | | | |
35-
|? |Matches exactly one |?n |an, in, on |ran |
36-
| |character in that position| | | |
37-
| | | | | |
38-
|[ ] |Matches a range of |[a-l]ook|book, cook, |took |
39-
| |characters | | look | |
40-
| | | | | |
41-
|[ ] |Matches the specified |[bc]ook |book, cook |hook |
42-
| |characters | | | |
43-
44-
You can include multiple wildcard characters in the same word pattern.
45-
For example, to find text files whose names begin with the letters "a"
46-
through "l", type:
32+
|* |Match zero or more characters | a* | aA, ag, Apple | banana |
33+
|? |Match one character in that position | ?n | an, in, on | ran |
34+
|[ ] |Match a range of characters | [a-l]ook | book, cook, look | took |
35+
|[ ] |Match specific characters | [bc]ook | book, cook | hook |
36+
37+
You can include multiple wildcard characters in the same word pattern. For
38+
example, to find text files with names that begin with the letters **a**
39+
through **l**, type:
4740

4841
```powershell
49-
Get-ChildItem c:\techdocs[a-l]*.txt
42+
Get-ChildItem C:\Techdocs\[a-l]*.txt
5043
```
5144

52-
Many cmdlets accept wildcard characters in parameter values. The
53-
Help topic for each cmdlet describes which parameters, if any, permit
54-
wildcard characters. For parameters in which wildcard characters are
55-
accepted, their use is case-insensitive.
45+
Many cmdlets accept wildcard characters in parameter values. The Help topic for
46+
each cmdlet describes which parameters accept wildcard characters. For
47+
parameters that accept wildcard characters, their use is case-insensitive.
5648

57-
You can also use wildcard characters in commands and script blocks, such as
58-
to create a word pattern that represents property values. For example, the
59-
following command gets services in which the ServiceType property value
60-
includes "Interactive".
49+
You can use wildcard characters in commands and script blocks, such as to
50+
create a word pattern that represents property values. For example, the
51+
following command gets services in which the **ServiceType** property value
52+
includes **Interactive**.
6153

6254
```powershell
63-
Get-Service | Where-Object {$_.ServiceType -like "*Interactive*"}
55+
Get-Service | Where-Object {$_.ServiceType -Like "*Interactive*"}
6456
```
6557

66-
In the following example, wildcard characters are used to find property
67-
values in the conditions of an If statement. In this command, if the
68-
Description of a restore point includes "PowerShell", the command adds the
69-
value of the CreationTime property of the restore point to a log file.
58+
In the following example, the `If` statement includes a condition that uses
59+
wildcard characters to find property values. If the restore point's
60+
**Description** includes **PowerShell**, the command adds the value of the
61+
restore point's **CreationTime** property to a log file.
7062

7163
```powershell
7264
$p = Get-ComputerRestorePoint
7365
foreach ($point in $p) {
7466
if ($point.description -like "*PowerShell*") {
75-
add-content -path C:\TechDocs\RestoreLog.txt "$($point.CreationTime)"
67+
Add-Content -Path C:\TechDocs\RestoreLog.txt "$($point.CreationTime)"
7668
}
7769
}
7870
```
7971

8072
## SEE ALSO
8173

82-
- [about_Language_Keywords](about_Language_Keywords.md)
83-
- [about_If](about_If.md)
84-
- [about_Script_Blocks](about_Script_Blocks.md)
74+
[about_Language_Keywords](about_Language_Keywords.md)
75+
76+
[about_If](about_If.md)
77+
78+
[about_Script_Blocks](about_Script_Blocks.md)
Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,78 @@
11
---
2-
ms.date: 06/09/2017
2+
ms.date: 3/28/2019
33
schema: 2.0.0
44
locale: en-us
55
keywords: powershell,cmdlet
66
title: about_Wildcards
77
---
8+
89
# About Wildcards
910

1011
## SHORT DESCRIPTION
12+
1113
Describes how to use wildcard characters in PowerShell.
1214

1315
## LONG DESCRIPTION
1416

1517
Wildcard characters represent one or many characters. You can use them to
1618
create word patterns in commands. For example, to get all the files in the
17-
C:\\Techdocs directory that have a .ppt file name extension, type:
19+
`C:\Techdocs` directory with a `.ppt` file name extension, type:
1820

1921
```powershell
20-
Get-ChildItem c:\techdocs\*.ppt
22+
Get-ChildItem C:\Techdocs\*.ppt
2123
```
2224

23-
In this case, the asterisk (*) wildcard character represents any characters
24-
that appear before the .ppt file name extension.
25+
In this case, the asterisk (`*`) wildcard character represents any characters
26+
that appear before the `.ppt` file name extension.
2527

26-
PowerShell supports the following wildcard characters.
28+
PowerShell supports the following wildcard characters:
2729

2830
|Wildcard|Description |Example |Match |No Match|
2931
|--------|--------------------------|--------|-------------|--------|
30-
|* |Matches zero or more |a* |aA, ag, Apple|banana |
31-
| |characters | | | |
32-
| | | | | |
33-
|? |Matches exactly one |?n |an, in, on |ran |
34-
| |character in that position| | | |
35-
| | | | | |
36-
|[ ] |Matches a range of |[a-l]ook|book, cook, |took |
37-
| |characters | | look | |
38-
| | | | | |
39-
|[ ] |Matches the specified |[bc]ook |book, cook |hook |
40-
| |characters | | | |
41-
42-
You can include multiple wildcard characters in the same word pattern.
43-
For example, to find text files whose names begin with the letters "a"
44-
through "l", type:
32+
|* |Match zero or more characters | a* | aA, ag, Apple | banana |
33+
|? |Match one character in that position | ?n | an, in, on | ran |
34+
|[ ] |Match a range of characters | [a-l]ook | book, cook, look | took |
35+
|[ ] |Match specific characters | [bc]ook | book, cook | hook |
36+
37+
You can include multiple wildcard characters in the same word pattern. For
38+
example, to find text files with names that begin with the letters **a**
39+
through **l**, type:
4540

4641
```powershell
47-
Get-ChildItem c:\techdocs[a-l]*.txt
42+
Get-ChildItem C:\Techdocs\[a-l]*.txt
4843
```
4944

50-
Many cmdlets accept wildcard characters in parameter values. The
51-
Help topic for each cmdlet describes which parameters, if any, permit
52-
wildcard characters. For parameters in which wildcard characters are
53-
accepted, their use is case-insensitive.
45+
Many cmdlets accept wildcard characters in parameter values. The Help topic for
46+
each cmdlet describes which parameters accept wildcard characters. For
47+
parameters that accept wildcard characters, their use is case-insensitive.
5448

55-
You can also use wildcard characters in commands and script blocks, such as
56-
to create a word pattern that represents property values. For example, the
57-
following command gets services in which the ServiceType property value
58-
includes "Interactive".
49+
You can use wildcard characters in commands and script blocks, such as to
50+
create a word pattern that represents property values. For example, the
51+
following command gets services in which the **ServiceType** property value
52+
includes **Interactive**.
5953

6054
```powershell
61-
Get-Service | Where-Object {$_.ServiceType -like "*Interactive*"}
55+
Get-Service | Where-Object {$_.ServiceType -Like "*Interactive*"}
6256
```
6357

64-
In the following example, wildcard characters are used to find property
65-
values in the conditions of an If statement. In this command, if the
66-
Description of a restore point includes "PowerShell", the command adds the
67-
value of the CreationTime property of the restore point to a log file.
58+
In the following example, the `If` statement includes a condition that uses
59+
wildcard characters to find property values. If the restore point's
60+
**Description** includes **PowerShell**, the command adds the value of the
61+
restore point's **CreationTime** property to a log file.
6862

6963
```powershell
7064
$p = Get-ComputerRestorePoint
7165
foreach ($point in $p) {
7266
if ($point.description -like "*PowerShell*") {
73-
add-content -path C:\TechDocs\RestoreLog.txt "$($point.CreationTime)"
67+
Add-Content -Path C:\TechDocs\RestoreLog.txt "$($point.CreationTime)"
7468
}
7569
}
7670
```
7771

7872
## SEE ALSO
7973

80-
- [about_Language_Keywords](about_Language_Keywords.md)
81-
- [about_If](about_If.md)
82-
- [about_Script_Blocks](about_Script_Blocks.md)
74+
[about_Language_Keywords](about_Language_Keywords.md)
75+
76+
[about_If](about_If.md)
77+
78+
[about_Script_Blocks](about_Script_Blocks.md)

0 commit comments

Comments
 (0)