Overview
This lecture introduces the difference between PowerShell commands, their aliases, and legacy command.exe commands, highlighting how to identify and use each in the Windows command line.
PowerShell Commands and Aliases
- PowerShell is a robust command language with both unique commands and familiar aliases from Linux.
- The get-help command provides more information about PowerShell commands.
- The get-alias command reveals the actual PowerShell command behind an alias (e.g., "ls" is an alias for get-child-item).
- get-child-item retrieves files and subdirectories of a specified item, similar to the Linux "ls" command.
- PowerShell commands are descriptive, making them easy to understand but longer to type.
- Aliases make working in PowerShell faster by providing shorthand for common commands.
Types of Commands in Windows
- Windows supports three ways to execute commands: real PowerShell commands, PowerShell aliases, and command.exe (MS-DOS) commands.
- command.exe commands are legacy commands from MS-DOS but still work due to backward compatibility.
- command.exe commands, like dir, also map to PowerShell commands such as get-child-item.
Command Help Differences
- Use get-help followed by a command (e.g., get-help ls) for PowerShell commands.
- Use /? (e.g., dir /?) for command.exe commands to access help documentation.
- PowerShell commands and command.exe commands handle help parameters differently and are not interchangeable (e.g., ls /? does not work).
Key Terms & Definitions
- PowerShell — A command-line shell and scripting language for Windows.
- Alias — A shorthand or alternative name for a command.
- get-help — PowerShell command to display help information about commands.
- get-alias — PowerShell command to show which command an alias refers to.
- get-child-item — PowerShell command to list items (files/directories) in a location.
- command.exe — A legacy Windows command-line interpreter supporting older MS-DOS commands.
Action Items / Next Steps
- Practice using get-help and get-alias to explore PowerShell commands and aliases.
- Try out both PowerShell commands and command.exe commands to understand their differences.