Command Prompt

Basic से Advanced तक – सम्पूर्ण ट्यूटोरियल

CMD क्या है?

Command Prompt (CMD) Windows का एक पावरफुल command-line interpreter है जो users को text-based commands के माध्यम से computer को नियंत्रित करने की सुविधा देता है। यह DOS (Disk Operating System) का successor है और Windows के सभी versions में उपलब्ध है।

CMD की विशेषताएं:

  • File और folder management के लिए powerful tools
  • Network configuration और troubleshooting
  • System administration tasks
  • Automation through batch scripting
  • Direct system access और control

CMD कैसे खोलें?

विधि 1: Run Command से

  1. Windows + R दबाएं
  2. “cmd” टाइप करें
  3. Enter दबाएं या OK पर क्लिक करें

विधि 2: Search से

  • Start Menu खोलें और “cmd” या “command prompt” search करें

विधि 3: Administrator Mode में

  • Start Menu में “cmd” search करें
  • Right-click करके “Run as administrator” चुनें

भाग 1: Basic Commands

1. Navigation Commands

DIR – Directory की Contents देखें

dir

यह command current directory में सभी files और folders की list दिखाता है।

उपयोगी विकल्प:

  • dir /w – Wide format में list
  • dir /p – Page by page display
  • dir /s – Subdirectories भी include करें
  • dir *.txt – केवल .txt files दिखाएं

CD – Directory Change करें

cd FolderName

किसी folder में enter करने के लिए।

उदाहरण:

  • cd Documents – Documents folder में जाएं
  • cd .. – एक level ऊपर जाएं
  • cd \ – Root directory में जाएं
  • cd /d D:\ – दूसरी drive में जाएं

2. File Operations

COPY – Files Copy करें

copy source.txt destination.txt

उदाहरण:

  • copy file.txt D:\Backup\ – File को दूसरी location पर copy करें
  • copy *.txt D:\AllTexts\ – सभी text files copy करें

MOVE – Files Move करें

move file.txt D:\NewLocation\

DEL/DELETE – Files Delete करें

del filename.txt

⚠️ सावधानी: Delete की गई files Recycle Bin में नहीं जातीं!

  • del *.tmp – सभी temporary files delete करें
  • del /p *.txt – Delete से पहले confirmation मांगें

REN/RENAME – Files Rename करें

ren oldname.txt newname.txt

3. Folder Operations

MKDIR/MD – नया Folder बनाएं

mkdir NewFolder

  • mkdir “My New Folder” – Space वाला folder बनाएं
  • mkdir Folder1\Subfolder1\Subfolder2 – Multiple folders एक साथ

RMDIR/RD – Folder Delete करें

rmdir FolderName

  • rmdir /s FolderName – Folder और उसके सभी contents delete करें
  • rmdir /s /q FolderName – बिना confirmation के delete करें

TREE – Directory Structure देखें

tree

यह command folder structure को tree format में दिखाता है।

  • tree /f – Files भी दिखाएं
  • tree /a – ASCII characters use करें

भाग 2: Intermediate Commands

4. File Content Commands

TYPE – File की Contents देखें

type filename.txt

MORE – Page by Page Display

more filename.txt

Large files को page by page देखने के लिए।

FIND – File में Text Search करें

find “search text” filename.txt

  • find /i “text” file.txt – Case-insensitive search
  • find /c “text” file.txt – केवल count दिखाएं

FC – Files Compare करें

fc file1.txt file2.txt

दो files के बीच differences दिखाता है।

5. System Information Commands

SYSTEMINFO – System की जानकारी

systeminfo

यह command system की detailed information देता है जैसे OS version, RAM, processor आदि।

HOSTNAME – Computer का नाम

hostname

VER – Windows Version

ver

TIME & DATE – समय और तारीख

  • time – System time देखें/बदलें
  • date – System date देखें/बदलें
  • time /t – केवल time देखें (बदलने का option नहीं)
  • date /t – केवल date देखें

6. Disk Management Commands

CHKDSK – Disk Check करें

chkdsk C:

Disk errors को check और fix करता है।

  • chkdsk C: /f – Errors fix करें
  • chkdsk C: /r – Bad sectors भी locate करें

DISKPART – Advanced Disk Management

diskpart

⚠️ सावधानी: यह बहुत powerful command है, गलत use से data loss हो सकता है!

FORMAT – Drive Format करें

format D: /fs:NTFS

⚠️ चेतावनी: Format करने से सभी data permanently delete हो जाएगा!

VOL – Volume Label देखें

vol C:

भाग 3: Advanced Commands

7. Network Commands

IPCONFIG – Network Configuration

ipconfig

Network adapter की basic information दिखाता है।

  • ipconfig /all – Detailed information
  • ipconfig /release – IP address release करें
  • ipconfig /renew – नया IP address प्राप्त करें
  • ipconfig /flushdns – DNS cache clear करें

PING – Network Connectivity Test

ping google.com

Website या server तक connectivity check करता है।

  • ping -t google.com – Continuous ping (Ctrl+C से रोकें)
  • ping -n 10 google.com – 10 बार ping करें

TRACERT – Route Trace करें

tracert google.com

Data packets का destination तक पूरा route दिखाता है।

NETSTAT – Network Statistics

netstat

Active network connections दिखाता है।

  • netstat -a – सभी connections और listening ports
  • netstat -n – Numerical form में addresses
  • netstat -b – कौनसा program कौनसा connection use कर रहा है

NSLOOKUP – DNS Lookup

nslookup google.com

Domain name का IP address पता करता है।

8. Process Management

TASKLIST – Running Processes देखें

tasklist

सभी running processes की list दिखाता है।

  • tasklist /svc – Services के साथ
  • tasklist /m – DLL modules के साथ

TASKKILL – Process बंद करें

taskkill /im notepad.exe

किसी running program को forcefully बंद करता है।

  • taskkill /pid 1234 – Process ID से बंद करें
  • taskkill /f /im chrome.exe – Forcefully बंद करें

START – Program चलाएं

start notepad.exe

  • start https://google.com – Default browser में website खोलें
  • start . – Current folder को Explorer में खोलें

9. User Management (Administrator)

NET USER – User Accounts Manage करें

net user

सभी user accounts की list दिखाता है।

  • net user username password /add – नया user बनाएं
  • net user username /delete – User delete करें
  • net user username * – Password change करें

WHOAMI – Current User जानकारी

whoami

  • whoami /priv – User privileges देखें
  • whoami /groups – User groups देखें

10. Batch Scripting Basics

Batch File क्या है?

Batch file एक text file है जिसमें commands का sequence होता है जो automatically execute होते हैं। इसका extension .bat या .cmd होता है।

पहली Batch File बनाएं:

Notepad खोलें और निम्न लिखें:

@echo off echo Hello World! echo यह मेरी पहली Batch File है pause

इसे “hello.bat” नाम से save करें और run करें।

Important Batch Commands:

  • @echo off – Commands को screen पर न दिखाएं
  • echo – Text display करें
  • pause – User के key press का wait करें
  • cls – Screen clear करें
  • rem – Comment लिखें (execute नहीं होगा)
  • exit – Batch file से बाहर निकलें

Variables का उपयोग:

@echo off set name=Rahul echo नमस्ते %name%! pause

User Input लें:

@echo off set /p name=अपना नाम लिखें:  echo नमस्ते %name%! pause

11. उपयोगी Utility Commands

SFC – System File Checker

sfc /scannow

Corrupted system files को scan और repair करता है। Administrator mode में चलाना जरूरी है।

DISM – Deployment Image Servicing

dism /online /cleanup-image /restorehealth

Windows image को repair करता है। SFC से पहले इसे चलाना अच्छा है।

SHUTDOWN – Computer बंद/Restart करें

  • shutdown /s /t 0 – तुरंत shutdown
  • shutdown /r /t 0 – तुरंत restart
  • shutdown /s /t 60 – 60 seconds बाद shutdown
  • shutdown /a – Scheduled shutdown cancel करें

POWERCFG – Power Configuration

  • powercfg /batteryreport – Battery की detailed report
  • powercfg /energy – Energy efficiency report

ASSOC – File Associations

assoc

File extensions के associations दिखाता है।

  • assoc .txt – .txt files का association देखें

भाग 4: Advanced Tips & Tricks

12. उपयोगी Shortcuts और Tips

Keyboard Shortcuts:

  • Tab Key – Auto-complete file/folder names
  • Up/Down Arrow – पिछले commands browse करें
  • Ctrl + C – Running command को रोकें
  • F7 – Command history देखें
  • Ctrl + M – Mark mode enable करें (text select के लिए)

Operators और Redirections:

  • > – Output को file में save करें

      उदाहरण: dir > list.txt

  • >> – Output को file में append करें

      उदाहरण: dir >> list.txt

  • | – Pipe – एक command का output दूसरे को input दें

      उदाहरण: dir | more

  • & – Multiple commands को एक साथ चलाएं

      उदाहरण: dir & cls & date

  • && – पहली command successful हो तो ही दूसरी चलाएं

      उदाहरण: mkdir test && cd test

  • || – पहली command fail हो तो ही दूसरी चलाएं

      उदाहरण: dir test || mkdir test

13. Environment Variables

SET – Variables देखें/बनाएं

set

सभी environment variables दिखाता है।

महत्वपूर्ण System Variables:

  • %USERNAME% – Current user का नाम
  • %COMPUTERNAME% – Computer का नाम
  • %USERPROFILE% – User profile folder path
  • %TEMP% – Temporary files folder
  • %SYSTEMROOT% – Windows directory (usually C:\Windows)
  • %PROGRAMFILES% – Program Files folder

उपयोग का उदाहरण:

echo %USERNAME% cd %TEMP% dir %SYSTEMROOT%

14. Security और Permissions

ATTRIB – File Attributes Change करें

attrib filename.txt

Attributes:

  • +r – Read-only बनाएं
  • -r – Read-only हटाएं
  • +h – Hidden बनाएं
  • -h – Hidden हटाएं
  • +s – System file बनाएं

उदाहरण:

attrib +h +s secret.txt attrib -r -h document.doc attrib +r /s *.txt

CIPHER – File Encryption

cipher /e filename.txt

Files को encrypt करने के लिए।

  • cipher /w:C:\ – Deleted files की जगह को securely overwrite करें

Quick Reference Table

सबसे ज्यादा उपयोग होने वाले commands की quick reference:

Commandविवरणउदाहरण
dirFiles और folders list करेंdir /s
cdDirectory change करेंcd Documents
mkdirनया folder बनाएंmkdir NewFolder
copyFile copy करेंcopy file.txt D:\
delFile delete करेंdel file.txt
renFile rename करेंren old.txt new.txt
typeFile contents देखेंtype file.txt
ipconfigNetwork info देखेंipconfig /all
pingNetwork connectivity testping google.com
tasklistRunning processes देखेंtasklist
taskkillProcess को बंद करेंtaskkill /f /im app.exe
systeminfoSystem informationsysteminfo
sfc /scannowSystem files repair करेंsfc /scannow
shutdownComputer shutdown/restartshutdown /r /t 0

Best Practices और सावधानियां

सुरक्षा संबंधी सावधानियां:

  • Administrator mode में commands सावधानी से चलाएं
  • Delete या Format commands से पहले दोबारा check करें
  • महत्वपूर्ण data का backup रखें
  • Unknown batch files को बिना देखे न चलाएं
  • System files के साथ experiment न करें

उत्पादकता के टिप्स:

  • बार-बार use होने वाले commands के लिए batch files बनाएं
  • Tab key का उपयोग करके time बचाएं
  • Command history (F7) का फायदा उठाएं
  • Help के लिए किसी भी command के साथ /? use करें
  • Important outputs को file में redirect करके save करें

निष्कर्ष

Command Prompt एक बेहद शक्तिशाली tool है जो Windows users को अपने system पर complete control देता है। इस guide में हमने basic से लेकर advanced commands तक सब कुछ cover किया है। Regular practice के साथ आप CMD में expert बन सकते हैं और अपने daily tasks को तेज़ी से complete कर सकते हैं।

याद रखें: Practice makes perfect! जितना ज्यादा आप CMD का उपयोग करेंगे, उतना ही comfortable feel करेंगे।

Happy Learning! 🚀

Command Prompt (CMD) – पूर्ण गाइड

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top
error: Content is protected !!