This is not a blog. So sue me!


Crikey, things are looking up!

Thursday, October 18, 2007

DOS commands for Windows

Some information about how to use windows command line commands. Some of this is actually useful.

For a Windows DOS-type command box (Start button | Run | cmd)

Windows folders, directories and filenames
The command line operates by default at a command line pointer, that is at a particular folder, on each drive. This is the command line prompt. Example, C:\temp>, commands will operate in this folder.

cd fred will change the directory setting to C:\temp\fred>
cd.. command moves up one directory level (back to C:\temp>)
d: command moves the command line pointer to the d drive (at the directory previously set for that).

Hierarchical folder (directory) names are separated by \ (contrary to Unix and web "folders").

/ is used for command switches for example: dir /w c:\t*

Most filenames have a three-letter "file extension" for historical reasons, file.txt for example.

*.* is the wildcard for file name match to anything (any name, any file extension).
*.txt for any file with extension txt

The following keys are sometimes useful in command line commands

Enter
submit the current command line to DOS and add it to the command line buffer at the end.
Left/Right arrow
moves cursor in the command line by one character left or right
Ctrl+Left/Right arrow
move cursor left or right to next word of cmd line (words separated by spaces)
End/Home
puts cursor at start or end of current line
Ctrl+Home
delete from current cursor position to start of current cmd line
Ctrl+End
delete from current cursor position to end of current cmd line
Delete
delete next character - that which is under the cursor
Ctrl+H/Backspace
deletes previous character - to left of cursor
Insert
toggle Overstrike/Insert mode. Overstrike will overwrite at the cursor. Insert will insert to the left of the cursor
ALT+ENTER
takes your command prompt to fullscreen mode and back again

Moving through the command line buffer
- repeating previous commands (or bits of them)
Up/Down arrow keys
move through the command lines buffer one line at a time.
Up goes to previous, Down goes to next (or nothing if we're viewing the last one)
PageUp
moves to first command in command line buffer
PageDown
moves to last command in command line buffer
F7
pops up your command history list, navigate with the up/down arrow keys and use Enter to select an entry
F9
brings up a dialog to enter the required number of the command from the buffer to be repeated
F1
brings up the next character of the previous command (starting at the first one)

Tab completion of commands is supported
For example, type edit *.ini then hit TAB to iterate through all matches.
Use SHIFT+TAB to move to the previous match.
This works for partial filenames as you would expect, and in all commands.

You can change the size of the command line buffer
Right-mouse on cmd.exe window title bar, then Properties | Options | Command history | Buffer size:

If a window output is going too fast to read, or a program is out of control
Ctrl+C will terminate the program (make sure you have clicked on this window to get focus!)
Ctrl+S will pause the output
Ctrl+Q will restart the output

Other stuff that has not been particularly useful
Ctrl+C clears the current command line
Ctrl+I insert a tab in the command line at current position
Ctrl+M Same as Enter key or CR (submit the current DOS command)
Ctrl+S Stop - ignores next keystroke

Continue (pagination shows --MORE--) Enter key (default is no pagination)

Copy and paste Window contents
Mark (right mouse, choose Mark)
start capturing a selection using the left mouse key & dragging.
End selection using Enter key.

Copy and paste into the command line
You can drag n' drop files or folders from an explorer window into a command prompt; this inserts the quoted path as if you had manually pasted it.
Ctrl+V does not paste into the command line, you have to Right click and select paste.

Dos commands help
help gives list of windows cmd line commands
help the_cmd give details about that command e.g. HELP DIR

Windows folders, directories and filenames
The command line operates by default at a command line pointer, that is at a particular folder, on each drive. This is the command line prompt. Example, C:\temp>, commands will operate in this folder.

cd fred will change the directory setting to C:\temp\fred>
cd.. command moves up one directory level (back to C:\temp>)
d: command moves the command line pointer to the d drive (at the directory previously set for that).

Hierarchical folder (directory) names are separated by \ (contrary to Unix and web "folders").

/ is used for command switches for example: dir /w c:\t*

Most filenames have a three-letter "file extension" for historical reasons, file.txt for example.

*.* is the wildcard for file name match to anything (any name, any file extension).
*.txt for any file with extension txt

No comments:

Contributors

St Lawrence Rowing

Test content from SLRC