CMD (Command prompt)
What is command prompt?
Command prompt is a terminal. A terminal is a text based process that allows commands. In this case command prompt is Windowsâs terminal. Command prompt is often referred to as; cmd, windows command processor or even command shell.Â
Q: is CMD MS-DOS? A: No. However, it does include many of the commands that MS-DOS has
What is CMD used for?
CMD is used for many practices and can be used for the average day use. CMD is the not GUI alternative for your systems needs. With CMD you can do many more things windows canât. CMD can be a massive time saver with its many commands. As anything to do with intermediate computer knowledge it will have rules, in this case we have syntax. CMDâs syntax is as easy as HTML! Wondering what CMD can do? Here are the things CMD is commonly used for:
Networking (Ipconfig, netstat, ping, ect)
File directories (mkdir, dir, cd)
Handy hardware info (system information, format, chkdsk, tree)
other (color, title,)Â
Where can CMD be found?
CMD can be found on all windows operating systems. This will include the popular; Windows Vista, Windows XP, Windows 7, Windows 8, Windows 10.
When using these operating systems all you have to do is press the following:
Windows key - type CMD or command prompt - click it
Some commands require administrator. To get these to work do the following:
windows key - type CMD or command prompt - right click it - click run as administrator
Q: What if im not running Windows? A: Well there are command shells in other operating systems. For instance:
 Linuxâs CMD can be found by using CNTRL + ALT + T
MacOSâs CMD can be found by opening applications - utilities - terminalÂ
Fun commands!
For these exercises we will be using windowsâs CMD. So to get you started lets do some fun things in CMD. Make sure to have CMD open. Try these following commands!
color a (This will make your text turn green. Using numbers and letters will change the text and background of CMD)
time 12:00:00.00 (this will allow you to change the time to the millisecond)
title The console (this will allow you to change the titleÂ
cls (This will clear the command prompt)
tree c: (This will show a diagram of your file directories in your C drive)
Useful commands!
These are the ease of life commands, the cream of the crop. With these it can reduce your time performing functions in windows.
dir (this will show your whole file directory. This includes the files in them. Try dir a* or dir *.ini. For file extensions the * comes first but for regular names the * comes last
tasklist (this shows the concurrent running programs)
taskkill /IM (this will force shutdown any process put after taskkill. Be careful with this one)
shutdown (this will either turn off your system or restart it or log it off. There are also other functions. -s is shutdown, -l is logoff, -r is restart, -t is timer, -hybrid prepares a fast bootup for the next time the system is turned on, -a stops a shutdown function, -sg is to shutdown but restart the applications upon next boot, /c is the comment. Try shutdown -s -t 999 /c âWill turn off in 999 secondsâ)
Making a .bat/.cmd file
For this you will need notepad open. Now you have it open copy or write the followingÂ
Making a rainbow
@echo off
echo this will make a rainbow
:rainbow
color 01
echo Rainbow!
color 02
echo Rainbow!
color 03Â Â
echo Rainbow!
color 04Â Â
goto rainbow
Now save the file. Do the following Click save as - click save as type - click all files - save the file as rainbow.bat or rainbow.cmd
Now double click what you just saved EPILEPSY WARNING
Rainbow explainedÂ
@Echo off hides the code but allows the result to be shown
echo is a print statementÂ
:rainbow is just a random name, The name doesnât have to be rainbow, it can be anything as long as thereâs a : behind it. This is basically a checkpoint for codeÂ
color 01 changes the text colour
goto rainbow makes the computer say okay im going to start the code back from where rainbow is
Making a prank (shutdown)
Remember how we talked about shutting down? Well what if you was to make a .bat/cmd file for a prank. Letâs make a script that shuts somebodyâs computer down, but only after we have talked to them first!
@echo off
echo Your computer will turn off in 30 seconds
Pause
echo Have fun!
Pause
shutdown -s -t 30Â
Now save the file. Do the following Click save as - click save as type - click all files - save the file as down.bat or down.cmd
Now double click what you just saved (if you want to open cmd again and type shutdown -a to avoid your PC shutting down)
Making a prank explainedÂ
@Echo off hides the code but allows the result to be shown
echo is a print statement
Pause makes the user press a button for the next line of code to execute
shutdown is the function to make the computer do a shutdown function -s if for turning the computer off -t is the timerÂ
When you shutdown as a test but forget to cancel















