By Tony Lee and Matt Kemelhar.
Navigating Windows in the most efficient manner possible can be seen as wizardry-- it almost seems as if Microsoft tries to make it increasingly more difficult to accomplish simple things. However, there are plenty of very useful tricks and shortcuts built into Windows, the problem is they are not publicized very well. Students in our Ultimate Hacking Courses usually find these Windows tips useful, so we figured we would share them.
F7 – Graphical command shell history After hitting F7, you can use the arrow keys to scroll up and down through the command history and then use the right key in order to edit the command or hit enter to run the command. The screenshot below shows a graphical command history is presented after the user presses F7. This can be navigated via arrow keys.
F1 – Letter by letter repeat of the last command
F2 – Retype letters up to a certain letter
F3 – Retype last command
F4 – Delete characters from the cursor up to a certain character
F5 – Scroll up through command history (same as up arrow)
F9 – Enter the command number you would repeat
This is often very useful when running commands whose output extends beyond the 80 character default width of the unaltered command shell.
Syntax:
Ex:
This screenshot shows you what it looks like to expand the window quickly with
This is very useful when setting different color shells to indicate different functionality.
The screenshot below shows two different windows with two different colors with netcat listeners on different ports.
This is also useful for labeling your windows with a title that is easy to remember and descriptive of what you are working on.
Let's see what this looks like - the screenshot below shows how to change the title of the window via the command line
Process lists:
Port lists:
Prefer WordPad over Notepad at times?
Want to launch it from the command line, but you hate typing the full path (
How about five letters?
Ever wanted to dump the contents of a particular directory or structure to a text file?
If you live in the command line and don’t want to spawn a graphical text editor to read a simple file, you can always “
Those are some of our favorite tricks to make Windows more convenient to use! Hopefully there was at least one trick here that is new for you.
Do you have any tricks that amaze others? Share them in the comments below!
Navigating Windows in the most efficient manner possible can be seen as wizardry-- it almost seems as if Microsoft tries to make it increasingly more difficult to accomplish simple things. However, there are plenty of very useful tricks and shortcuts built into Windows, the problem is they are not publicized very well. Students in our Ultimate Hacking Courses usually find these Windows tips useful, so we figured we would share them.
Command shell history
If you thought “doskey /history
” was cool—this is even better and more useful. Function keys help control and recall the command history in Windows. We have noted the most useful keys and their function below. Try them out for yourself.F7 – Graphical command shell history After hitting F7, you can use the arrow keys to scroll up and down through the command history and then use the right key in order to edit the command or hit enter to run the command. The screenshot below shows a graphical command history is presented after the user presses F7. This can be navigated via arrow keys.
F1 – Letter by letter repeat of the last command
F2 – Retype letters up to a certain letter
F3 – Retype last command
F4 – Delete characters from the cursor up to a certain character
F5 – Scroll up through command history (same as up arrow)
F9 – Enter the command number you would repeat
Command shell shortcuts
Adjusting the command shell to fit your preference can sometimes be a headache (too much clicking for a shell) here are some ways to customize the view without touching the mousemode
– adjusting the size of the command shell
This is often very useful when running commands whose output extends beyond the 80 character default width of the unaltered command shell.Syntax:
mode [width],[height]
Ex:
mode 120,120
This screenshot shows you what it looks like to expand the window quickly with
mode
.color
- Sets the default console foreground and background colors
This is very useful when setting different color shells to indicate different functionality.COLOR [attr]
attr Specifies color attribute of console output
Color attributes are specified by TWO hex digits -- the first corresponds to the background; the second the foreground. Each digit can be any of the following values:
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White
If no argument is given, this command restores the color to what it was when CMD.EXE started.
The screenshot below shows two different windows with two different colors with netcat listeners on different ports.
Title
- Sets the window title for the command prompt window
This is also useful for labeling your windows with a title that is easy to remember and descriptive of what you are working on.TITLE [string] string Specifies the title for the command prompt window.
Let's see what this looks like - the screenshot below shows how to change the title of the window via the command line
findstr
– (grep for Windows)
findstr
searches for strings in files [or anything else]. If you wanted grep in Windows, you got it. findstr
has been present in Windows since XP and 2003. It accepts regular expressions and can search case insensitive (/I
). One of our favorite ways to use this command is for filtering—especially long lists such as process listings and listening ports.Process lists:
C:\>tasklist | findstr /i EXPLORER
explorer.exe 3404 Console 1 119,884 K
Port lists:
C:\>netstat -an | findstr 135
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP [::]:135 [::]:0 LISTENING
C:\>netstat -an | findstr 445
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP [::]:445 [::]:0 LISTENING
UDP 127.0.0.1:63445 *:*
write
- the greatest shortcut ever
Prefer WordPad over Notepad at times?Want to launch it from the command line, but you hate typing the full path (
c:\Program Files\Windows NT\Accessories\wordpad.exe c:\Program Files (x86)\Windows NT\Accessories\wordpad.exe
) to launch it?How about five letters?
w r i t e
tree
– graphical “text” directory listings
Ever wanted to dump the contents of a particular directory or structure to a text file? tree
is the way to go—it is fast and recursive. The “/F
” attribute will list the files in addition to the folders—leave it off and you just get the folders. "/A
" is useful if you are sending output to a text file or other document.TREE [drive:][path] [/F] [/A]
/F Display the names of the files in each folder.
/A Use ASCII instead of extended characters.
C:\> tree /a /f c:\users
Folder PATH listing for volume PSV
Volume serial number is 8800-000
C:\USERS
+---Tony
| | test.exe
| | Sti_Trace.log
| |
| +---Contacts
| | Tony.contact
| |
| +---Desktop
| | | cmd.txt
| | | fixPrinter.bat
| | | malicious.exe
| | | research.txt
--snip--
type
- when you can’t spare the GUI
If you live in the command line and don’t want to spawn a graphical text editor to read a simple file, you can always “type
” the file. This is similar to “cat
” in *nix. If you need to read larger documents, it can be piped to more or just use more to read the file in the first place.TYPE [drive:][path]filename
C:\>type %TEMP%\readme.txt
"This is how you can read a text file from the command line"
Those are some of our favorite tricks to make Windows more convenient to use! Hopefully there was at least one trick here that is new for you.
Do you have any tricks that amaze others? Share them in the comments below!