The command prompt is an essential part of all the Windows versions by Microsoft. But, how many of you do use this command tool? A very few number of users uses it because there are some shortcut graphical ways to handle the Windows system.
Though the Windows command prompt has not have too much popularity this days, there are certain things that can be done only from the command line. Here are some essential commands which you might not know.
All the screenshots used in this article has been taken from a Windows 7 computer but most of the tools are being used from a long time and available in almost all earlier and latest versions of Windows (Windows XP, Vista and Windows 8).
Some tools may require the command prompt having the ‘Administrator’ privilege. To run command prompt with ‘Administrator’ privilege, right-click on the cmd icon and choose “Run as Administrator”.
1. System Information
You can take a quick tour on the system information in Windows with this command tool. There are lots of third party applications to check the system information but you can do it using a single command line in the command prompt. You can even export the system information in your preferred file format.
To get the system information into the command prompt window itself, run the following command:
If you want to export the file into a text file, use the following command line:
c:\>systeminfo > myfile.txt
You can use your desired file name and format replacing myfile.txt. More power come to this command by adding the following parameters:
- /S – This parameter specifies the remote system in which the command should run.
- /U – This specifies the user context.
- /P – This option specifies the password for the given user. If you omit this parameter in the syntax, you will be prompted for the password input.
- /FO – This option lets to specify the format of the output. The valid formats are “List”, “Csv”, “Table”.
- /NH – This specifies that the column header won’t be displayed in to the output.
This command displays the list of all the installed hardware drivers in a local or remote computer. The ‘Driverquery’ command lets you to investigate about the driver versions or keep a reference for future use. Simply typing the command
driverquery at the command line will generate the list of all drivers which are currently installed at your computer. Adding some parameter with the command enhance the result as usual.
- /S – Specifies the remote system to which you want to connect.
- /U – This parameter specifies the user context under which the command should execute.
- /P – This parameter specify the password for the given user. Omitting the parameter will prompt to input the password.
- /FO – It specifies the type of the output. The valid values are “TABLE”, “LIST”, “CSV”.
- /NH – This parameter specifies that the “Column Header” should not be displayed.
- /SI – This parameter give the formation about signed drivers.
- /V – Shows verbose output. It is not valid for the signed drivers.
To export the list into simple text file run the following command:
c:\>driverquery > yourfile.txt
To export the report into a CSV file you can run the following command:
c:\>driverquery /FO CSV > yourfile.csv
You can then use any spreadsheet application like Excel or Google Docs to see the nicely formatted report of the installed drivers in a computer.
3. Check Disk
The Windows system automatically gets messed up as well as some bad sectors occupy the hard disk as they get older. The check disk utility, which is there inbuilt in almost all Windows operation system, automatically recovers the readable data from the bad sectors, fixes the repairable disk errors, even locks the bad sectors of hard drive so that Windows never use those in future. The check disk utility is triggered by the OS automatically when it requires. The scan process is started at the starting of your computer. Once it completes the scan, it fixes the issue automatically.
But, if you want to run the scan process manually, type
chkdsk at the command prompt. You can also enhance this command by adding a space with above syntax followed by the following parameters:
CHKDSK [volume[[path]filename]]] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]] [/B]
- volume – You can specify your drive letter (make sure to put a colon after the letter to specify a driver letter), any mount point or the volume name.
- filename – This parameter works only for FAT/FAT32 file system. With this you can force the system to check fragmentation for that file system.
- /F – It fixes e the disk errors.
- /V – This parameter works differently in different file systems. FAT/FAT32: It displays the full path/name of every file on the disk. NTFS: Displays the cleanup messages if there is any.
- /R – It discovers the bad sectors of the hard disk and recovers the readable information (implies /F).
- /L:size – It works for only NTFS. It changes size of the log file to the specified number of kilobytes. On no size specification it displays the current size.
- /X – It forces to dismount the volume first when necessary. All other handles to the volume would then be invalid (implies /F).
- /I – NTFS only: It performs a less robust check of the index entries.
- /C – NTFS only: It skips the checking within the folder structure cycles.
- /B – NTFS only: It re-evaluates the bad clusters on the volume (implies /R).
The /I or /C switch is used to reduce the time by skipping certain checks.
4. System File Checker
Unlike the chkdsk command, it checks only the system files. Windows has the ability of checking the missing or disputed files and it replaces them (if necessary) silently without any participation from the user side. Nevertheless, some system files can get corrupted or misplaced due to installation of wrong or errant applications.
This command line tool, System File Checker scans your system’s hundreds of thousands files. It compares the files with the original files or the files from Windows update. If it detects any dispute, it automatically replaces the original one. Depending on your installation process it may or may not need the installation media.
To run this tool, simply type
sfc and a space followed by the following parameters.
- /scannow – To perform the scan immediately, use this parameter. On the detection of any problem it automatically replaces that file. You may need to rerstart your computer after getting done with the scan process.
- /scanonce – This parameter should be used if you want to perform the scan process at the time of next reboot.
- /scanboot – This parameter is used to schedule the scan. It will run the scan process every time you reboot your computer.
- Revert – Use this parameter to return the tool to its default settings. If you applied the /scanboot option, you can trigger that off by using of this option.
cipher command deals with encrypted files and folders. Though there is a graphical interface to control the encryption, this command line tool is nice to handle the encrypted files and folders from the command prompt programmatically by using batch file. Among the numbers of parameter options (run cipher /? to learn the parameters of this command) with this command, the following option might be useful.
The above command wipes out the deleted but hanging data around the unused volume of your hard disk.
We did not provide all the commands that are available with Windows command line feature. We just highlighted some useful commands that you may find useful. For the complete list of command line syntax refer to Command-line reference A-Z.