Open the Command Prompt application.
FYI: If you are into maximum efficiency through keyboard shortcuts, get there quick by pressing the "windows" button, then begin typing the word "command", then hit enter when you see "Command Prompt" show up. 😺
After typing each of the commands below, press "enter" to execute it.
Optionally, clear previous output at any time by typing "CLS" and pressing "enter".
Print the current user's name:
whoami
Print the current/present working directory:
cd
List files in the current working directory:
dir
Change directories (specifying absolute file path):
cd C:\Users\YOUR_USERNAME\Desktop\ # where YOUR_USERNAME is the name of the user currently operating your local machine
Make a new directory:
mkdir my_folder
Remove a directory:
rmdir my_folder
Change directories (using relative file path):
cd my_folder # first re-create this directory if it doesn't exist, else this will trigger an error
FYI: Use the command
cd ..
to move "up" one directory relative to the current working directory.
Create one or more files:
type nul > README.md
type nul > index.html
type nul > my_data.csv
type nul > my_message.txt
CLARIFICATION: yes,
type
is part of the command 😺
Remove/delete a file:
del index.html
Edit and save a file, using a command-line utility provided by your preferred text editor (just choose one of these, depending on which editor you're using):
code my_message.txt # VS Code
atom my_message.txt # Atom, requires "Install Shell Commands" from the Atom Settings
Print file contents:
type my_message.txt
Move a file to target location:
move C:\Users\YOUR_USERNAME\Desktop\my_folder\my_message.txt C:\Users\YOUR_USERNAME\Desktop
FYI: If you are into maximum efficiency, press "tab" to auto-complete file paths so you don't have to type the whole thing. 😺
Copy a file:
xcopy C:\Users\YOUR_USERNAME\Desktop\my_message.txt C:\Users\YOUR_USERNAME\Desktop\my_folder
Copy contents of a file into the clipboard for pasting:
type C:\Users\YOUR_USERNAME\Desktop\my_folder\my_message.txt | clip
# ... then just paste as you normally would after copying some text
Optionally explore additional command-line interfaces, if you're curious.
Trace the route traveled by a network request:
tracert google.com # stop after a few seconds if necessary by pressing: control + c
Time the duration of a network request:
ping google.com # stop after a few seconds if necessary by pressing: control + c
Download the cURL utility if necessary, then request the contents of a webpage:
curl google.com
curl http://www.google.com
curl https://raw.githubusercontent.com/prof-rossetti/georgetown-opim-243-201901/master/data/products.json
You may need to execute these commands from within the downloaded directory. See "Installing cURL on Windows" for more support.