about_command_precedence.help

About_command_preced - TOPIC about_Command_Precedence SHORT DESCRIPTION Describes how Windows PowerShell determines which command to run LONG

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 TOPIC about_Command_Precedence SHORT DESCRIPTION Describes how Windows PowerShell determines which command to run. LONG DESCRIPTION This topic explains how Windows PowerShell determines which command to run, especially when a session contains more than one command with the same name. It also explains how to run commands that do not run by default, and it explains how to avoid command-name conflicts in your session. COMMAND PRECEDENCE When a session includes commands that have the same name, Windows PowerShell uses the following rules to decide which command to run. These rules become very important when you add commands to your session from modules, snap-ins, and other sessions. -- If you specify the path to a command, Windows PowerShell runs the command at the location specified by the path. For example, the following command runs the FindDocs.ps1 script in the C:\TechDocs directory: C:\TechDocs\FindDocs.ps1 As a security feature, Windows PowerShell does not run executable (native) commands, including Windows PowerShell scripts, unless the command is located in a path that is listed in the Path environment variable ($env:path) or unless you specify the path to the script file. To run a script that is in the current directory, specify the full path, or type a dot (.) to represent the current directory. For example, to run the FindDocs.ps1 file in the current directory, type: .\FindDocs.ps1 -- If you do not specify a path, Windows PowerShell uses the following precedence order when it runs commands: 1. Alias 2. Function 3. Cmdlet 4. Native Windows commands
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 Therefore, if you type "help", Windows PowerShell first looks for an alias named "help", then a function named "Help", and finally a cmdlet named "Help". It runs the first "help" item that it finds. For example, assume you have a function named Get-Map. Then, you add
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/03/2010 for the course BUS fin taught by Professor Fez during the Spring '10 term at Valparaiso.

Page1 / 4

About_command_preced - TOPIC about_Command_Precedence SHORT DESCRIPTION Describes how Windows PowerShell determines which command to run LONG

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online