Skip to content

Instantly share code, notes, and snippets.

@haakym
Last active November 27, 2023 07:01
Show Gist options
  • Save haakym/1718322bc592c62c197419800d4c4e03 to your computer and use it in GitHub Desktop.
Save haakym/1718322bc592c62c197419800d4c4e03 to your computer and use it in GitHub Desktop.
Windows CMD Quick Reference

Files and Directories

Command Description
dir / a List directory including hidden files
dir * .png List any file that ends in ".png"
mkdir Make directory
rmdir /s Remove directory and contents
wmic logicaldisk get name List all drives
e: S witch drive
tree Folder structure
attr i b File attributes
attr i b +h file.txt Add file attributes
attr i b -h file.txt Remove file attributes
echo hello > file.txt Create file on the fly
type file.txt Read contents of a file
del file.txt Delete file
echo hello > file.txt Overwrite file text (1. file.txt = "hello")
echo world > file.txt Overwrite file text (2. file.txt = "world")
echo hello > file.txt Append to a file (1. file.txt = "hello")
echo world >> file.txt Append to a file (2. file.txt = "hello world")
dir > directory.txt Command results to file
copy source.text copy/here Copy a file to a directory
xcop y folder1 folder2 Copy contents from folder1 to folder2 (no sub-directories)
xcop y folder1 folder2 /s Copy contents from folder1 to folder2 (inc sub-directories)
move folder1 folder2 Move a directory, folder1 into folder2
rename folder1 folderA Rename a directory

Misc

Command Description
cls Clear CMD
command /? Show help/options for a command
Type file name in directory open file in default program
path Show environment path
color /? List all available colours
color 0A Change colours
color Default colours
@Ravlissimo
Copy link

mistake in "attrib" command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment