You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -31,66 +30,64 @@ PowerShell uses the following rules to decide which command to run.
31
30
These rules become very important when you add commands to your session
32
31
from modules, snap-ins, and other sessions.
33
32
34
-
-- If you specify the path to a command, Windows PowerShell runs the
35
-
command at the location specified by the path.
33
+
- If you specify the path to a command, Windows PowerShell runs the command at the location specified by the path.
36
34
37
35
For example, the following command runs the FindDocs.ps1
38
-
script in the C:\TechDocs directory:
36
+
script in the "C:\TechDocs" directory:
39
37
38
+
```
40
39
C:\TechDocs\FindDocs.ps1
40
+
```
41
41
42
42
As a security feature, Windows PowerShell does not run executable
43
43
(native) commands, including Windows PowerShell scripts, unless the
44
44
command is located in a path that is listed in the Path environment
45
-
variable ($env:path) or unless you specify the path to the script
45
+
variable `($env:path)` or unless you specify the path to the script
46
46
file.
47
47
48
48
To run a script that is in the current directory, specify the full
49
-
path, or type a dot (.) to represent the current directory.
49
+
path, or type a dot `(.)` to represent the current directory.
50
50
51
51
For example, to run the FindDocs.ps1 file in the current directory,
52
52
type:
53
53
54
+
```
54
55
.\FindDocs.ps1
56
+
```
55
57
56
-
-- If you do not specify a path, Windows PowerShell uses the following
57
-
precedence order when it runs commands:
58
+
- If you do not specify a path, Windows PowerShell uses the following precedence order when it runs commands:
58
59
59
-
1. Alias
60
-
2. Function
61
-
3. Cmdlet
62
-
4. Native Windows commands
60
+
1.Alias
61
+
2.Function
62
+
3.Cmdlet
63
+
4.Native Windows commands
63
64
64
65
Therefore, if you type "help", Windows PowerShell first looks for an
65
66
alias named "help", then a function named "Help", and finally a
66
67
cmdlet named "Help". It runs the first "help" item that it finds.
67
68
68
-
For example, if you have a Get-Map function in the session and you
69
-
import a cmdlet named Get-Map. By default, when you type "Get-Map",
70
-
Windows PowerShell runs the Get-Map function.
69
+
For example, if you have a "Get-Map" function in the session and you
70
+
import a cmdlet named "Get-Map". By default, when you type "Get-Map",
71
+
Windows PowerShell runs the "Get-Map" function.
71
72
72
-
-- When the session contains items of the same type that have the same
73
-
name, such as two cmdlets with the same name, Windows PowerShell
74
-
runs the item that was added to the session most recently.
73
+
- When the session contains items of the same type that have the same name, such as two cmdlets with the same name, Windows PowerShell runs the item that was added to the session most recently.
75
74
76
-
For example, if you have a cmdlet named Get-Date and you import
77
-
another cmdlet named Get-Date, by default, Windows PowerShell runs
75
+
For example, if you have a cmdlet named "Get-Date" and you import
76
+
another cmdlet named "Get-Date", by default, Windows PowerShell runs
78
77
the most-recently imported cmdlet when you type "Get-Date".
79
78
80
-
HIDDEN and REPLACED ITEMS
79
+
# HIDDEN and REPLACED ITEMS
80
+
81
81
As a result of these rules, items can be replaced or hidden by items with
82
82
the same name.
83
83
84
-
-- Items are "hidden" or "shadowed" if you can still access the original
85
-
item, such as by qualifying the item name with a module or snap-in
86
-
name.
84
+
- Items are "hidden" or "shadowed" if you can still access the original item, such as by qualifying the item name with a module or snap-in name.
87
85
88
86
For example, if you import a function that has the same name as a
89
87
cmdlet in the session, the cmdlet is hidden (but not replaced)
90
88
because it was imported from a snap-in or module.
91
89
92
-
-- Items are "replaced" or "overwritten" if you can no longer access
93
-
the original item.
90
+
- Items are "replaced" or "overwritten" if you can no longer access the original item.
94
91
95
92
For example, if you import a variable that has the same name as a
96
93
a variable in the session, the original variable is replaced and is
@@ -103,30 +100,34 @@ is no longer accessible.
103
100
104
101
# FINDING HIDDEN COMMANDS
105
102
106
-
The All parameter of the Get-Command cmdlet gets all commands with the
103
+
The **All** parameter of the [Get-Command](../Get-Command.md) cmdlet gets all commands with the
107
104
specified name, even if they are hidden or replaced. Beginning in Windows
108
-
PowerShell 3.0, by default, Get-Command gets only the commands that run
105
+
PowerShell 3.0, by default, `Get-Command` gets only the commands that run
109
106
when you type the command name.
110
107
111
-
In the following examples, the session includes a Get-Date function and a
112
-
Get-Date cmdlet.
108
+
In the following examples, the session includes a "Get-Date" function and a
0 commit comments