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
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"
- | find “word to search” (case sensitive)
- | find /i “word to search” ( case insensitive)
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
Syntax
“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
Syntax
C:\ dir /q
6. Find a file
Syntax
C:\dir /b /s <directory to search> <file>
Example
C:\dir /b /s c:\ key.txt
/b gives full file path
/s does a recursive search
7. Find a folder
Syntax
dir /b /s /aD <directory to search> <folder>
Example
C:\dir /b /s /aD c:\Users\*key*
Searches for folder key in “c:\Users\”
/aD search only for directory
8. List users in system
- net user
- net user /domain (/domain to list users in domain)
9. Adding/deleting a user
- Add user
- net user /add
- Delete User
- net user del
10. Groups
- Create new group
- net localgroup /add
- Delete group
- net localgroup /del
- List users in a group
- net localgroup
- List groups
- net localgroup
- Add user to group
- net localgroup /add “username”
— By Fabian Darius