Chapter 1. The Windows PowerShell Interactive Shell
Introduction
Above all else, the design of Windows PowerShell places priority on its use as an efficient and powerful interactive shell. Even its scripting language plays a critical role in this effort, as it too heavily favors interactive use.
What surprises most people when they first launch PowerShell is its similarity to the command prompt that has long existed as part of Windows. Familiar tools continue to run. Familiar commands continue to run. Even familiar hotkeys are the same. Supporting this familiar user interface, though, is a powerful engine that lets you accomplish once cumbersome administrative and scripting tasks with ease.
This chapter introduces PowerShell from the perspective of its interactive shell.
1.1. Run Programs, Scripts, and Existing Tools
Problem
You rely on a lot of effort invested in your current tools. You have traditional executables, Perl scripts, VBScript, and of course, a legacy build system that has organically grown into a tangled mess of batch files. You want to use PowerShell, but don’t want to give up everything you already have.
Solution
To run a program, script, batch file, or other executable command in the system’s path, enter its filename. For these executable types, the extension is optional:
Program.exe arguments ScriptName.ps1 arguments BatchFile.cmd arguments
To run a command that contains a space in its name, enclose its filename in single-quotes (') and precede the command with an ampersand ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access