35 Windows Commands you NEED to know with examples and explanation
Tags: windows, commands, beginners, productivity
Published: 2023-01-08 17:13:45

Here are 35 Windows Commands you NEED to know with example and explanation

1. dir - Display a list of files and folders in a directory.
    - Example: `dir C:\Users\`
    - Explanation: This command will display a list of files and folders in the C:\Users\ directory.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/dir>

2. cd - Change the current directory.
    - Example: `cd C:\Windows\`
    - Explanation: This command will change the current directory to C:\Windows.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cd>

3. copy - Copy one or more files to another location.
    - Example: `copy C:\file.txt D:\backup\`
    - Explanation: This command will copy the file.txt from the C:\ directory to the D:\backup\ directory.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/copy>

4. del - Delete one or more files.
    - Example: `del C:\file.txt`
    - Explanation: This command will delete the file.txt file from the C:\ directory.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/del>

5. type - Display the contents of a text file.
    - Example: `type C:\file.txt`
    - Explanation: This command will display the contents of the file.txt file in the C:\ directory.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/type>

6. ren - Rename a file or directory.
    - Example: `ren C:\oldname.txt newname.txt`
    - Explanation: This command will rename the oldname.txt file in the C:\ directory to newname.txt.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/ren>

7. rmdir - Remove an empty directory.
    - Example: `rmdir C:\emptyfolder`
    - Explanation: This command will remove the emptyfolder directory from the C:\ directory.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/rmdir>

8. md - Create a new directory.
    - Example: `md C:\newfolder`
    - Explanation: This command will create a new folder called "newfolder" in the C:\ directory.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/md>

9. pushd - Change the current directory and push the current directory onto a stack.
    - Example: `pushd C:\Windows\`
    - Explanation: This command will change the current directory to C:\Windows\ and push the current directory onto a stack.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/pushd>

10. popd - Change the current directory to the topmost directory on the stack.
    - Example: `popd`
    - Explanation: This command will change the current directory to the topmost directory on the stack.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/popd>

11. netstat - Display active TCP connections and ports on which the computer is listening.
    - Example: `netstat -a`
    - Explanation: This command will display all active TCP connections and the ports on which the computer is listening.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/netstat>

12. ipconfig - Display the current TCP/IP configuration.
    - Example: `ipconfig`
    - Explanation: This command will display the current TCP/IP configuration for the computer.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/ipconfig>

13. ping - Test the connection to a remote host.
    - Example: `ping www.google.com`
    - Explanation: This command will test the connection to [www.google.com](http://www.google.com) by sending a series of packets and displaying the response time.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/ping>

14. tracert - Trace the route to a remote host.
    - Example: `tracert www.google.com`
    - Explanation: This command will trace the route to [www.google.com](http://www.google.com) and display the hops taken to reach the destination.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/tracert>

15. telnet - Connect to a remote host using the Telnet protocol.
    - Example: `telnet www.google.com`
    - Explanation: This command will connect to [www.google.com](http://www.google.com) using the Telnet protocol.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/telnet>

16. nslookup - Query DNS to resolve a hostname to an IP address or vice versa.
    - Example: `nslookup www.google.com`
    - Explanation: This command will query DNS to resolve the hostname [www.google.com](http://www.google.com) to an IP address.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/nslookup>

17. tasklist - Display a list of currently running processes.
    - Example: `tasklist`
    - Explanation: This command will display a list of currently running processes on the computer.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/tasklist>

18. taskkill - Terminate a running process.
    - Example: `taskkill /pid 1234`
    - Explanation: This command will terminate the process with the process ID 1234.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/taskkill>

19. systeminfo - Display system information.
    - Example: `systeminfo`
    - Explanation: This command will display information about the system, such as the operating system version and the installed hotfixes.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/systeminfo>

20. driverquery - Display a list of installed device drivers.
    - Example: `driverquery`
    - Explanation: This command will display a list of installed device drivers on the computer.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/driverquery>

21. net - Manage network resources.
    - Example: `net share`
    - Explanation: This command will display a list of shared network resources.
    - For More Details: <https://learn.microsoft.com/en-us/troubleshoot/windows-server/networking/net-commands-on-operating-systems>

22. netdom - Manage Active Directory domains and trusts.
    - Example: `netdom join contoso /domain:contoso.com /userd:contoso\admin /passwordd:password`
    - Explanation: This command will join the computer to the contoso domain using the contoso\admin user and password.

23. sfc - Scan and repair system files.
    - Example: `sfc /scannow`
    - Explanation: This command will scan all protected system files and replace any corrupted files with a cached copy.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/sfc>

24. chkdsk - Check a disk for errors and repair them.
    - Example: `chkdsk C: /f`
    - Explanation: This command will check the C: drive for errors and repair them if possible.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/chkdsk>

25. diskpart - Manage disks, partitions, and volumes.
    - Example: `diskpart`
    - Explanation: This command will open the DiskPart utility, which allows you to manage disks, partitions, and volumes from the command line.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/diskpart>

26. bcdedit - Manage the boot configuration data store.
    - Example: `bcdedit /set {default} bootstatuspolicy ignoreallfailures`
    - Explanation: This command will set the boot status policy to ignore all failures.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/bcdedit>

27. bootrec - Repair the boot configuration data store.
    - Example: `bootrec /fixboot`
    - Explanation: This command will repair the boot configuration data store and write a new boot sector to the system partition.

28. shutdown - Shut down the computer.
    - Example: `shutdown /s`
    - Explanation: This command will shut down the computer.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/shutdown>

29. logoff - Log off the current user.
    - Example: `logoff`
    - Explanation: This command will log off the current user.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/logoff>

30. powercfg - Configure power options.
    - Example: `powercfg /hibernate on`
    - Explanation: This command will enable the hibernate feature.

31. wmic - Execute Windows Management Instrumentation (WMI) commands.
    - Example: `wmic path win32_process get name`
    - Explanation: This command will display the names of all processes running on the computer.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/wmic>

32. reg - Manage the registry.
    - Example: `reg add HKLM\Software\Example /v ValueName /t REG_SZ /d "Hello World"`
    - Explanation: This command will add a new value to the registry at HKLM\Software\Example.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/reg>

33. cmdkey - Manage stored user names and passwords.
    - Example: `cmdkey /add:server01 /user:john /pass:password`
    - Explanation: This command will add a new stored user name and password for the server01 server.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cmdkey>

34. certutil - Manage certificates.
    - Example: `certutil -addstore -enterprise root ca.crt`
    - Explanation: This command will add the ca.crt certificate to the enterprise root certificate store.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/certutil>

35. schtasks - Schedule tasks to run at a specific time.
    - Example: `schtasks /create /tn "Backup Task" /tr "robocopy C:\data D:\backup /mir" /sc daily /st 01:00`
    - Explanation: This command will create a new task called "Backup Task" that runs the robocopy command to copy data from C:\data to D:\backup every day at 1:00 AM.
    - For More Details: <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks>

If You are using [Medium](https://medium.com/) Please support and follow me for interesting articles. **[Medium Profile](https://medium.com/@kanani-nirav)**

**If this guide has been helpful to you and your team please share it with others!**