Command Prompt and PowerShell
The New Command Prompt
If you have been following the evolution of Windows through time, you will know the only thing that has been there since the very start (and one that has seen the least number of changes) -- the command prompt. In fact, this is superficially the same deal with Windows 10 -- opening up the command prompt will greet you with pretty much the same interface that was there since the early years.
However, the new Command Prompt hides all its progress behind the typical white-on-black screen. In the past, the Windows command prompt has been criticized by the technical elite as being a poor facsimile of the more powerful variants found in competing operating systems. In response, Microsoft is now trying to bring the feature up to date.
The Shortcut Menu
On the upper-left corner of the command prompt window is its icon, and clicking it will reveal the shortcut menu. Again, this appears similar to the same shortcut menu found on Windows 8's command prompt. However, clicking the Properties menu will make things more interesting.
The last tab in Properties will say "Options", and will be the main hub for all of the Prompt's new features (under "Edit Options"):
- Line wrapping selection
- Clipboard filtering on paste
- Wrapping text output on resize
- Enabling Ctrl-key shortcuts
- Extended edit keys
- Trimming leading zeroes
Through the Experimental tab, these settings can be enabled or disabled one-by-one or all together (via "Use legacy console"). By default, all of these are enabled except for "Trim leading zeroes on selection".
All these new features allow you to work in the command prompt like you would with any other text editor. This especially applies to the Ctrl-key shortcuts -- copy, and paste.
The main problem with circa-Windows 8 command prompts is the fact that the selection process is broken. Usually, selecting text by simply dragging the mouse pointer will result in a box being drawn over the block of text. This will not select end-to-end, like how the selection process commonly works -- to do this, one will have to select all the way from the prompt. Furthermore, even activating the selection process takes a few more clicks as one will have to go to Edit → Mark.
Another issue with this version of the command prompt is line-wrapping when you resize the window. Pulling the right edge of the command prompt, for example, will cause the right portion of the text to be hidden from view. This forces one to work with a fixed-size command prompt.
Finally, the original command prompt's copy-paste options aren't exactly nifty. For one, the user will have to go to the Edit → Copy and Edit → Paste options when doing these commands. Then, when the pasting is done, any multi-line block of text will be pasted line-by-line. Usually, this churns up an error message for each line.
In view of all these, the biggest change for the current incarnation of the command prompt is the ability to copy, paste, resize, and much more as if you were doing everything in Notepad or a similar utility. You have complete control over where selection starts and ends, and no need to visit the "Edit" menu over and over! Simply the keyboard shortcuts will do (though unfortunately the copy command from a shortcut menu is still unavailable).
List of all Command Prompt Keyboard Shortcuts:
- Ctrl + V or Ctrl + Insert. This command copies the selected text to your clipboard
- Ctrl + V or Shift + Insert. This pastes the text you copied
- Ctrl + A. This selects all the text within the current line. If there is no text in the line, then all text in the prompt will be selected.
- Ctrl + Up/Down arrow key. This moves the screen one line up or down, in a similar manner to scrolling.
- Ctrl + Page Up/Page Down. This moves the screen one whole page up or down.
- Ctrl + F. This opens the "Find" Window to search through the Command Prompt.
- Ctrl + M. This enters the Mark mode.
- Shift + Up/Down. This moves the cursor a whole line up or down, and then selects the text.
- Shift + Left/Right. This moves the cursor one character left or right, then selects the text.
- Ctrl + Shift + Left/Right. This moves the cursor one word left or right, then selects the text.
- Shift + Page Up/Page Down. This moves the cursor up or down one screen, and then selects the text.
- Shift + Home/End. This moves the cursor to the beginning or end of your current line, and then selects the text.
- Ctrl + Shift + Home/End. This moves the cursor to the beginning or end of the screen buffer. Then select the text and the beginning or end of the command prompt output.
- Alt + F4. This closes the Command Prompt.
Command Prompt Tips and Tricks
If you are looking for concrete examples of how the Command Prompt can make your life much easier, then these are what you are looking for:
- Find a specific file on the hard disk. "dir filename /s"
- Locate a file on the hard disk, excluding the directory info. "dir filename /s/b"
- Export a list of files with the same extension to a text file. "dir *.mp3 /b > filelist.txt"
- Find any directory. "dir dirname /s /ad
- Press the tab key for filename or directory auto-complete.
- View a list of previously entered commands. Press F7, and then scroll through the list with the arrow keys.
- View TCP or IP settings. "netsh interface ip show config"
- Find a string (say, "Windows") in a list of files with the same extension (say, ".doc"). "findstr /i /s "Windows" *.doc"
Aside from the big usability improvement, there are also a few other nifty features you can use if you are a power user (or if you just want to explore). One of them is the transparency feature that allows you a slider at the bottom of the Options tab in Properties. This allows you to adjust the transparency of the command prompt window anywhere from 100% to 30%. You can also do this on the fly, without accessing the Options box:
- Ctrl + Shift + +. Increases the transparency.
- Ctrl + Shift + -. Decreases the transparency.
On top of this, you can select the colors being used in your command prompt, in case black and white aren't your preferred colors.
Aside from the command prompt, these aforementioned options are also available not just for the command prompt but also for the PowerShell. And speaking of the latter...
Powershell vs Command Prompt
Since 7, a new command-line environment has been born in the Windows system -- the PowerShell. While some may think it just looks like an amped command line, it actually is one -- it is a more powerful command-line shell, and can give a system administrator a more useful command line environment.
Given the additional power, the Shell is a lot more complicated that the usual command prompt. In fact, it can compete with the more powerful shells available for Linux and Unix-like systems.
For one, the PowerShell uses a different set of commands, called cmdlets. These are similar to the ones tackled earlier, when we dissected how to change the international settings. Many of the system admin tasks like managing the registry and the Windows Management Instrumentation (WMI) are exposed through the PowerShell cmdlets while they remain inaccessible in the Command Prompt.
Like Linux and other Unix-like systems, PowerShell uses pipes -- a system that lets the user pass on the output of one cmdlet as the input of another cmdlet. This allows the manipulation of multiple cmdlets in order to perform actions on the same data. In fact, the PowerShell can even one-up the Linux and Unix-like shells since it can pipe not only texts but also objects between cmdlets. Such ability allows the system to share more complex data among cmdlets.
On top of this all, the PowerShell is not simply a shell that can be used -- it is also a scripting environment that has found favor among many power users and IT pros. Knowledge in the PowerShell can give you better control that the Command Prompt in managing the Windows system.
Whereas the command line is mostly a legacy environment since the time of DOS, the PowerShell is a new platform without much of the limitations. With the addition of the new Win10 features not only in the Command Prompt but also in PowerShell, things just got more powerful.