steps_windows-os-basic-cli-commands
steps_windows-os-basic-cli-commands
Commands
Help or /? gets available commands, or displays help info for commands echo /?
< type's filename and sends text to command command < filename
systeminfo config information for local or remote machine;includes service pack levels systeminfo
dir "directory"; used to display contents of files and sub directories of current working directory dir c:\myDirectory
move moves files from one folder till another move .\document.txt
c:\document.txt
find search for a text string in a file & display all the lines where it is found find \I "hard to find text
findstr search for a text string in a file & display all the lines where it is found; supports regular findstr /r "^[1-9][0-9]"
expressions sales.txt
attrib displays or changes files attributes if a file has the System or Hidden attribute set, you attrib +H +S
must clear that attribute before you can change any other attributes makeMeHiddenAndSystem.txt
Commands (cont)
icacls change file and folder permissions - display or modify Access Control Lists (ACLs) for files and Read the Damned Help File
folders RTFM (Read The F@#$ing Manual)
fc compare the contents of two files or sets of files; display any lines which do NOT match fc fileOne.txt fileTwo.txt
comp compare two files (or sets of files) ; display items that do not match comp fileOne fileTwo
tasklist displays all running applications and services with their Process ID (PID) This can be run on either tasklist /FI "IMAGENAME eq
a local or a remote computer Calculator.exe"
sc Service Control - Create, Start, Stop, Query or Delete any Windows SERVICE. The command sc query type= driver RTFM
options for SC are case sensitive
ping test a network connection - if successful, ping returns the ip address ping -n 1 8.8.8.8
tracert "tracer route" tracks path to destination and counts hops (can also resolve ip addresses if used on tracert WRKST002
domain names)
netstat display current TCP/IP network connections and protocol statistics netstat -a RTFM
Success and failures for commands are based on the Exit Code of the command.
In most cases the Exit Code is the same as the ErrorLevel
Numeric handles:
doskey banner=(echo. ^& echo *** Step $* *** ^& echo.) ^>^> c:\location\answers.txt
MAKE SURE YOU PUT YOUR ANSWER FILE IN THE RIGHT PLACE