Introduction: How to Make a Command Prompt Defragmenter in Windows!! (works for All Versions of Windows)
Welcome to my first instructable! :D
Hi, my name is Kwesi Quincy (instructables username iCoder), and I am a boy of age 15 who likes to code, build stuff, and DJ. I will be posting more instructables in the future, so please stay tuned!
DISCLAIMER: I am not responsible for any bricked PCs whatsoever. USE THE CMD TOOL AT YOUR OWN RISK OR IF YOU KNOW WHAT YOU ARE DOING! DO NOT RUN ANY COMMANDS YOU DO NOT KNOW ABOUT!!
So what is a defragger? A defragger is a tool built into Windows to remove fragment of files left on your system. Basically as you remove programs from your system, there are fragments it leaves behind and eventually it accumulates and scatters in your system, so when your PC is starting up from sleep or Power On, the hard drive read head has to go on a scanning rampage to bring all files together, and in this case (if you have a HDD LED on your PC/Laptop), you will see it light up steady (not flashing) and your PC will be remarkably slow. Alternatively, you can go to Start>Type in defrag>defrag and use it, but instead of having to go through that step, you can just have a double-click shortcut on your desktop that you can access at any time just in case your HDD LED is stabily lighted, or when your PC is being slow at reading/writing files on or off the HDD. So in that case, welcome to the instructable on how to do so!! Enjoy!
Step 1: Open Notepad
There are many ways to open notepad. You can use the Windows Key+R and type in Notepad or go to Start>type in notepad if it is not pinned in start menu>click notepad.
Step 2: First Steps on the Defragger
For the lazy people who do not want to type everything, I included the .bat file. Feel free to download it!
Now type in:
@echo off (it turns off the C:\Users\PCNAME\ thing that shows up in CMD when you open it)
cls (clears the screen)
Step 3: Second Steps on Defragger: the Timer
This step is optional, but if you want to add a timer, you can go ahead and do so.
Use this command as many times as you want since one syntax equals one second.
ping 2 127.0.0.1>nul
Step 4: Third Steps on the Defragger: THE MAIN COMMAND
Now this is the command that does it all: the defrag command.
At this stage, type in this command:
Example: defrag /c /h /u
You can also add other stuff to the file at this point. You can ALSO make changes even after you have saved the file.
Step 5: Fourth Steps on Defragger: Saving (very Important)
Now here comes the important part: the saving part.
You do not want to save it as a .txt file, or it will open in notepad again.
So go to File>Save As...>and type in the name you want with the extension .bat (or it will not work)
Click on Save As type dropdown box and click All Files or it will still save as YOURNAMEHERE.bat.txt
Step 6: Creating Your Shortcut
Now you want to create a shortcut in order to customize the file because the original file is not customizable (changing icons and making it run as admin - steps ahead)
So right click anywhere on the desktop and hover your cursor over New>and click shortcut
A dialog box will appear. Go to the directory you saved your file in and copy and paste it into the search bar. Then click next.
Step 7: Giving It a Name
Now give the shortcut a name (EXAMPLE: Command-line Defragger)
Click finish, and now you have the icon on your desktop.
At this point you are done! YAY. BUT ONE MORE THING BEFORE YOU OPEN IT OR IT WILL NOT WORK.
Step 8: Setting the Shortcut to Run As Administrator.
You need to make sure that the shortcut is ran as administrator (which basically makes the main file run as admin, since the shortcut links to it), and in order to do it, right-click on the shortcut and click properties. Click on the Advanced button at the bottom of the Properties window. On the screen that pops up, check Run As Administrator (if you are admin it will not require the admin password, if that account has one) and click OK, then click OK on the properties box to save changes.
Step 9: Change Icon (optional)
This step is also optional, but you can go ahead and download icons from iconarchive.com for free if you do not want to use the built-in Windows icons.
Assuming the Properties window is still open (LOL I said close it, open it again :D) click on Change Icon, a popup will appear, just click OK or close it.
A dialog box will appear with the icons. Choose any of them or use the icon you downloaded by clicking Browse, and going to the directory in which the icon was downloaded to (e.g. C:\Users\PCNAME\Desktop) and selecting the icon. Click OK when you are done, and close the window.
REMEMBER: THIS CAN ONLY BE DONE ON THE SHORTCUT, AND NOT THE FILE ITSELF.
Step 10: Finally..... the Last Step.
Close the Properties window and open the file.
IT WORKS! YAY!
You have now made your own CMD Defragger that is easy to access! GREAT JOB!
Enjoy using the tool, and don't forget to stay tuned for more instructables!
Step 11: LOL THIS IS NOT a STEP, But My Contact Infos
Check out my YouTube channels: https://www.youtube.com/channel/UCf3lOcvdZppa3KMOZ...
Check out my soundcloud: https://soundcloud.com/soundlogik-usa
Twitter: showofftech_ and officialsoundlogik
Instagram: officialsoundlogik and deejayawana