Windows Command Line Commands - Basic, Most Useful Commands
[A] ATTRIB: While on GUI, you can right click on a file or folder to set attributes: hidden, or read-only. The GUI offers you only these two attributes. If you wish to associate system attribute or archive (handy for incremental backups), you can use ATTRIB.
The usage of this command is as follows:
The + symbol adds an attribute while the - symbol removes the attribute. You can add/remove one or more attribute to a file, a set of files, or even folders.
Example: ATTRIB +h +s -r C:\Windows\System32\*.ini
[B] RENAME: Used to rename a file/folder or a set of files/folders
Example: Rename W*.txt to Z*.txt (renames all txt files starting with W to txt files starting with Z). Imagine achieving this using Windows GUI.
[C] DEL: Used to delete files and folder saving you time on selecting files to be deleted using GUI
You can use /S to direct the command to delete all subfolders too.
IMPORTANT TIP: Del c:\*.tmp /s removes all .tmp files from the C drive. I use this command very often to remove the temp and log files.
To delete files based on attributes, use /A:attribute. Example: Del d:\*.txt /s /a:-h deletes all files on D drive that do not carry the hidden attribute. If the hyphen preceding 'h' is removed, it deletes all files that carry the hidden attribute.
[D] DiskComp: Saves time by comparing two FLOPPY disks.
Usage: DiskComp A: B: checks for floppy disks in both drives and informs you if they both contain same data.
Example: DiskComp A: A: employs a single drive to compare two floppy disks.
DISKCOMP cannot be used for HDDs, CDs, or any network drives.
[E] FORMAT: Formats a given drive (except the system drive) with some options that are absent while formatting with GUI.
FORMAT D: /FS:FAT32 /V:data /A:1024 (Formats D drive using FAT32 file-system, assigns it the volume name "data" and takes care that each allocation unit in the file-system is equal to 1024. The /A parameter allows you to set the size of each allocation unit.)
FORMAT also lets you specify the number of tracks and sectors while used as Windows Command Line command.
Usage: FORMAT D: /T:track_num /N:sector-num.
You can add /C so that FORMAT allows compression on the drive. This can be used only when you specify NTFS with /FS.
Note that /A cannot be used along with /T
[F] IPCONFIG: Allows you to check the IP addresses of all your adaptors, flush DNS, and manually register a computer DNS - all without having to reboot the computer.
IPCONFIG, as such, displays basic IP information
IPCONFIG /ALL displays full information for all the adaptors
IPCONFIG /FLUSHDNS clears the DNS without rebooting client
IPCONFIG /RENEW "Adaptor Name" renews the DHCP IP address without having to reboot the entire network.
[G] PING: Helps you determine if your network is up. You can use PING with the IP address of any computer on the network to see if it is active. You can also check the internet connection even if you do not know the IP address of any site.
To check if your computer is able to cross the ISP gateway, use PING with website name:
PING www.google.com (sends four pings to google.com)
To send repeated pings, use /T (example: PING 126.96.36.199 /T)
When used as such, PING tries four times and informs you about the number of successful connections.
PING is especially useful when you are not sure if an Internet Connectivity problem is with ISP or local. If you can successfully Ping the ISP gateway but not any website, the problem lies locally. If PING to ISP gateway fails, it is ISP's fault.
These are common Windows Command Line commands that help users speed up computer tasks while also helping with troubleshooting networks and Internet. The next part of the Windows Command Line Guide contains more commands for using Windows Components from Command Prompt.