<<

Windows OS Basic CLI Commands Cheat Sheet by steps via cheatography.com/76111/cs/18824/

Commands

Help or /? gets available commands, or displays for commands /? echo prints following info to STDOUT echo hello world prints contents to STDOUT type helloWo​ rld​ .txt

> redirect; sends output to file command > filename

>> append command >> filename

< type's filename and sends text to command command < filename

2> sends error message to file echpo 2> error.txt

| pipes output from left to right command1 | command 2 hostname displays hostname of system hostname displays windows version ver displays disk volume and serial number vol systeminfo config informa​ tion for local or remote machine;i ncludes service pack levels system​ info set used to manage variables set mySweet​ Var​ iab​ le=​ wha​ tIt​ Equ​ als "c​ hange directo​ ry"​ ; displays the name of current or changes cd c:\ "d​ ire​ cto​ ry"​ ; used to display contents of files and sub directo​ ries of current working directory dir c:\myDi​ rec​ tory /md directory md c:\myDi​ rec​ tor​ y\​ chil​ dDi​ rec​ tory /rd remove directory rd c:\myDi​ rec​ tor​ y\​ chil​ dDi​ rec​ tory prints to STDOUT, but one screen a more reallyL​ ong​ Tex​ t.txt copies one or more files to another location copy file.txt c:\newL​ oca​ tio​ n\​ file​ .txt copies files and filders xcopy c:\misp​ lac​ edD​ ire​ ctory c:\corr​ ect​ \ri​ ght​ Spo​ tDi​ rec​ tory moves files from one folder till another move .\docum​ ent​ .txt c:\docu​ men​ t.txt /rename rename a file or files ren monday.txt Tuesday deletes one or more files del basura.txt search for a text string in a file & display all the lines where it is found find \I "hard to find text search for a text string in a file & display all the lines where it is found; supports regular findstr /r "^​ [1-​ 9][​ 0-9​ ]" express​ ions sales.txt displays or changes files attributes if a file has the System or Hidden attribute set, you attrib +H +S must that attribute before you can change any other attribu​ tes makeMeH​ idd​ enA​ ndS​ yst​ em.txt

By steps Published 14th February, 2019. Sponsored by Readability-Score.com cheatography.com/steps/ Last updated 14th February, 2019. Measure your website readability! Page 1 of 2. https://readability-score.com Windows OS Basic CLI Commands Cheat Sheet by steps via cheatography.com/76111/cs/18824/

Commands (cont) icacls change file and folder permiss​ ions - display or modify Access Control Lists (ACLs) for files and Read the Damned Help File folders RTFM (Read The F@#$ing Manual) compare the contents of two files or sets of files; display any lines do NOT match fc fileOne​ .txt fileTwo​ .txt compare two files (or sets of files) ; display items that do not match comp fileOne fileTwo shutdown or restart a computer shutdown /t 120 displays all running applica​ tions and services with their Process ID (PID) This can be run on either tasklist /FI "I​ MAG​ ENAME eq a local or a remote computer Calcula​ tor​ .​ e" sc Service Control - Create, , Stop, Query or Delete any . The command sc query type= driver RTFM options for SC are case sensitive manage network resources net group "a​ dmi​ nis​ tra​ tors' /domain RTFM displays network adaptor informa​ tion ipconfig /all ping a network connection - if success​ ful, ping returns the ping -n 1 8.8.8.8 tracert "t​ racer " tracks to destina​ tion and counts hops (can also resolve ip addresses if used on tracert WRKST002 domain names) display current TCP/IP network connect​ ions and protocol statistics netstat -a RTFM time displays time time /T date displays date date /T

Success and failures for commands are based on the Code of the command. In cases the Exit Code is the same as the ErrorLevel Numeric handles:

STDIN = 0 Keyboard input STDOUT = 1 Text output STDERR = 2 Error text output UNDEFINED = 3-9

Make Macro For Answer Sheet Creation =​ (echo. ^& echo *** Step $* *** ^& echo.) ^>^​ > c:\loca​ tio​ n\​ answ​ ers​ .txt

MAKE SURE YOU PUT YOUR ANSWER FILE IN THE RIGHT PLACE

By steps Published 14th February, 2019. Sponsored by Readability-Score.com cheatography.com/steps/ Last updated 14th February, 2019. Measure your website readability! Page 2 of 2. https://readability-score.com