Windows command line reference – Part01

A list of windows commands,

1. stdin, stdout, stderr

stdin – 0 stdout – 1 stderr – 2

C:\unknown.exe >output.txt

stderr 2 will redirect errors in command to file output.txt

2. Using Find command

C:\ file.txt | find /i "word to search"
C:\ file.txt |find "word to search"

3. Command history

C:\doskey /history

Gives history of commands in cmd prompt. “F7” will present a pop up window with history.

4. line count


“filename”   |find  /c  /v  “” <no space between quotes> 
(number of lines including spaces)

“filename”   |find  /c  /v  “<space>”
(number of lines without spaces)

5. File Owners


C:\ dir /q

file owners

6. Find a file


C:\dir  /b  /s  <directory to search> <file>
C:\dir  /b  /s  c:\ key.txt

/b gives full file path /s does a recursive search Find File

7. Find a folder


dir  /b  /s  /aD  <directory to search> <folder>

C:\dir /b /s /aD c:\Users\*key*

Searches for folder key in “c:\Users\” /aD search only for directory Find Folder

8. List users in system

9. Adding/deleting a user

Adding User Delete User

10. Groups

List groups

list Users in a group

#howto #notes

— By Fabian Darius