CMD
Press + R to open the Run dialog box.
Type “CMD” and Windows offers you to start the command prompt where you can enter DOS commands.
Notice that before you press Enter you can right click the icon and choose to start the command prompt with admin privileges, which is needed for some commands.
The command prompt provides a text-based interface for you to interact with the OS by typing commands.
Notice that the Command Prompt window allows you to open multiple tabs.
You can enter various commands in the Command Prompt to perform tasks, manage files and folders, configure system settings, and more.
The Command Prompt refers to folders as "directories".
Common commands include dir (list files and directories), cd (change directory), mkdir (create a directory), copy (copy files), move (move files), and del (delete files).
The Command Prompt supports several keyboard shortcuts, such as:
- Ctrl+C (to cancel a running command),
- Ctrl+V (to paste text)
- Ctrl+Arrow keys (to navigate through command history)
You can customize the Command Prompt's appearance and behavior by right-clicking its title bar and selecting "Settings". This allows you to change font size, colors, and other settings.
Redirection and Pipes:
You can redirect command output to a file using the > or >> operators (e.g., command > output.txt).
Pipes (|) allow you to send the output of one command as input to another (e.g., command1 | command2).
One of the most commonly used commands is Ping, to test network connectivity.
Should you try to ping another computer, be aware that ping replies are disabled by default on Windows 10 and beyond.
To allow ping replies, use this command:
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
To block it again
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=block
Other useful commands to enter at the command prompt:
- Windows repair command line
- DISM.exe /Online /Cleanup-image /Restorehealth
- sfc /scannow
- To uninstall a patch: wusa /uninstall /kb:XXXXXXXX (replace X with the patch number such as 5002099)
- To find the WiFi password for a Wifi network : netsh wlan show profile WIFI_NAME key=clear
- To get the list of local accounts: wmic userAccount get Name
- To display the system uptime: systeminfo | find "System Boot Time”
Other useful commands you can enter either in the Run dialog box or at the command prompt:
- Regedit: to access the registry
- Winver: to get the Windows version
- Msconfig: Allows you to set the startup mode, to see the programs running at startup
- control keymgr.dll: Allows you to see the credentials used to connect network drives
- Inetcpl.cpl: opens the Internet properties. When accessing files from network drives, you might receive a warning "These files may damage the computer". To avoid this, in this interface you can go to Security, Local Intranet, Sites, Advanced. Here you can add the IP address or server name you trust so that you do not receive this warning. Then reboot the system.
Batch files
A batch file is a text file with the extension .bat or .cmd.
A batch file contains one or more commands.
When you run the batch file, the computer carries out each command in the order they are listed.
Batch files can be useful for automating repetitive tasks.
PowerShell
In addition to the traditional Command Prompt, Windows also includes PowerShell, which is a more powerful and modern command-line shell. PowerShell provides access to a wide range of system management features and is scriptable using PowerShell scripts (.ps1).
Example of PS commands
- Disk space used: wmic logicaldisk get size,freespace,caption
- Soft installed: Get-WmiObject -Class Win32_Product
- Updates installed: Get-HotFix
MMC
MMC stands for Microsoft Management Console, which allows you to host various administrative tools called "snap-ins." Each snap-in is a separate management console that focuses on a specific aspect of system configuration. Among available snap-ins:
- Computer Management (compmgmt.msc)
Provides access to system tools like Device Manager, Disk Management, Local Users and Groups, and more. - Device Manager
Allows you to check for unrecognized devices - Event Viewer (eventvwr.msc)
Allows you to view and analyze system logs and event records - Local users and groups
- Group Policy Object Editor (gpedit.msc)
Gpedit allows you to configure group policies for controlling user and computer settings on a network. - Services (services.msc)
Lets you manage Windows services, including starting, stopping, and configuring them.
Windows services are programs which run automatically in the background, regardless of whether a user is logged in.
Sometimes a service may need to be stopped or restarted as a troubleshooting step. - Performance
- Task scheduler
- Windows Defender Firewall.
You can launch MMC from the Run dialog box or from the Command prompt.
You can create custom MMC consoles tailored to your specific needs. This involves selecting and adding snap-ins to a console, arranging them in the desired order, and configuring settings such as default views and saved console settings.
One of the most useful is the Group Policy Object Editor (gpedit.msc). Gpedit allows you to configure group policies for controlling user and computer settings on a network.
You might like to view this video