Windows commands, often referred to as Command Prompt (CMD) commands, are text-based instructions used to perform tasks in the Windows operating system via the Command Prompt or PowerShell.
These commands allow users to manage files, configure system settings, troubleshoot issues, and automate tasks. Below is an overview of commonly used Windows commands, grouped by their functionality:
1. Basic File and Directory Management Commands
• dir: Lists files and directories in the current directory.
• Example: dir /a (shows all files, including hidden ones).
• cd [directory]: Changes the current directory.
• Example: cd Documents (navigates to the Documents folder).
• mkdir [directory]: Creates a new directory.
• Example: mkdir NewFolder.
• rmdir [directory]: Removes a directory (must be empty).
• Example: rmdir OldFolder.
• copy [source] [destination]: Copies files from one location to another.
• Example: copy file.txt D:\Backup.
• move [source] [destination]: Moves files or directories.
• Example: move file.txt D:\.
• del [file]: Deletes a specified file.
• Example: del temp.txt.
• ren [oldname] [newname]: Renames a file or directory.
• Example: ren oldfile.txt newfile.txt.
2. System Information and Configuration
• systeminfo: Displays detailed system configuration information.
• Example: systeminfo | find "OS Name".
• ipconfig: Shows network configuration details.
• Example: ipconfig /all (displays full network info).
• tasklist: Lists all running processes.
• Example: tasklist | find "notepad".
• taskkill /IM [process] /F: Terminates a specified process.
• Example: taskkill /IM notepad.exe /F.
• chkdsk [drive]: /f: Checks and fixes disk errors.
• Example: chkdsk C: /f.
• sfc /scannow: Scans and repairs protected system files.
• shutdown /s /t [seconds]: Shuts down the computer after a specified time.
• Example: shutdown /s /t 60 (shuts down in 60 seconds).
• shutdown /r: Restarts the computer.
• set: Displays or modifies environment variables.
• Example: set PATH=%PATH%;C:\NewPath.
3. Network Commands
• ping [hostname]: Tests connectivity to a network host.
• Example: ping google.com.
• tracert [hostname]: Traces the route to a network host.
• Example: tracert google.com.
• netstat -an: Displays active network connections and ports.
• nslookup [hostname]: Queries DNS to obtain domain name or IP address.
• Example: nslookup google.com.
• net [command]: Manages network resources (e.g., users, shares).
• Example: net user (lists user accounts).
4. File and Disk Management
• format [drive]:: Formats a disk for use with Windows.
• Example: format D: /FS:NTFS.
• diskpart: Opens a disk partitioning utility for advanced disk management.
• Example: diskpart then list disk.
• fsutil: Performs advanced file system tasks.
• Example: fsutil fsinfo drives (lists available drives).
• xcopy [source] [destination]: Copies files and directories with advanced options.
• Example: xcopy C:\Data D:\Backup /E.
5. System Maintenance and Troubleshooting
• assoc: Displays or modifies file extension associations.
• Example: assoc .txt (shows program associated with .txt files).
• driverquery: Lists installed device drivers.
• gpupdate /force: Updates group policy settings immediately.
• reg [operation]: Manages Windows Registry (e.g., add, delete keys).
• Example: reg query HKLM\Software.
• wmic: Executes Windows Management Instrumentation commands.
• Example: wmic bios get serialnumber.
6. Batch File and Scripting
• echo: Displays text or enables/disables command echoing.
• Example: echo Hello World.
• for: Runs a command for each item in a set.
• Example: for %f in (*.txt) do echo %f (lists all .txt files).
• if: Performs conditional processing in batch scripts.
• Example: if exist file.txt echo File exists.
• @: Suppresses command echoing for a single line in a batch file.
• %: Represents variables in batch scripts.
• Example: set var=Hello then echo %var%.
7. Advanced Commands
• powershell: Opens PowerShell from CMD for advanced scripting.
• bcdedit: Manages Boot Configuration Data.
• Example: bcdedit /enum (lists boot entries).
• robocopy [source] [destination]: Advanced file copying with mirroring and retry options.
• Example: robocopy C:\Data D:\Backup /MIR.
• wevtutil: Manages Windows event logs.
• Example: wevtutil qe System (queries system event log).
How to Use Commands
1. Open Command Prompt:
• Press Win + R, type cmd, and press Enter.
• Or search for “Command Prompt” in the Start menu.
2. Run as Administrator:
• Right-click Command Prompt and select “Run as administrator” for commands requiring elevated privileges (e.g., chkdsk, sfc).
3. Get Help:
• Use [command] /? to display help for any command.
• Example: dir /? shows options for the dir command.
Notes
• Case Insensitivity: Commands are not case-sensitive (e.g., DIR and dir are the same).
• PowerShell Alternative: Many CMD commands have PowerShell equivalents with more advanced features. To use PowerShell, type powershell in CMD or open PowerShell directly.
• Batch Files: Commands can be combined in .bat or .cmd files for automation.
• Safety: Be cautious with commands like del, format, or reg, as they can cause data loss or system issues if misused.
If you need examples or details for specific commands or want to explore PowerShell equivalents, let me know!
That was a really clear and informative explanation of the vulnerability!
ReplyDelete