Windows command line
The Windows command line
(or
DOS
command-line)
on Microsoft Windows
also has commands you can type at a prompt.
Getting started
- Search/Run - cmd
- cls (like UNIX clear)
- dir
- cd (works like in UNIX)
cd C:\
cd \
- cd (with no argument) (is like UNIX pwd)
Install Shakespeare on C drive
- For some exercises in this section, I have downloaded the
Works of Shakespeare
to the C drive.
- You might like to do that too, so you can try the same exercises.
- Get the ZIP
- Extract all
- Save to C:\shakespeare
- In command line:
cd \shakespeare
Commands and wildcards
- Go to Shakespeare:
cd \shakespeare
- find (like grep)
find "Henry" home.html
Wildcards
- File wildcards work.
Go into "richardii" and try:
find "Ireland" *.html
Lists all files plus matches.
Lists files even if they have no matches.
- Some directory wildcards work.
From the home Shakespeare directory:
cd macb*
- Some directory wildcards don't work.
From the home Shakespeare directory, this works:
find "Ireland" richardii\*.html
but this does not work:
find "Ireland" *\*.html
- You can get around this by writing a batch file with a FOR loop.
Misc
- Case insensitive
- Up-arrow - history
- Ctrl-C - interrupt command-line program
- Select - Copy
- Right-click - Paste
Customisation
- Change prompt:
- prompt
- prompt $v$s$g$s
- default is probably: prompt $p$g$s
- Change colour:
- color
- color f0 (black on white)