Sebagian besar dari kita mengandalkan Antarmuka Pengguna Grafis (GUI) karena lebih nyaman daripada menghafal baris perintah tradisional. Namun satu hal yang pasti—Anda tidak dapat melakukan setiap tugas di Windows GUI, dan saat itulah Command Prompt dapat melayani Anda.
Antarmuka baris perintah bawaan ini dapat menghasilkan keluaran langsung menggunakan perintah sederhana dengan sumber daya komputer yang lebih sedikit. Dengan cara ini, Anda tidak perlu menavigasi melalui jendela yang berbeda hanya untuk menyelesaikan satu tugas. Dengan program ini, Anda dapat menjalankan fungsi administratif tingkat lanjut atau memecahkan berbagai masalah Windows sendiri!
Dalam artikel ini, saya akan membahas 50 perintah yang harus Anda ketahui untuk menguasai Command Prompt. Namun jika Anda relatif baru dengan utilitas ini, sebaiknya periksa panduan pemula kami terlebih dahulu.
Perintah Dasar
Sebelum mendalami perintah utama, saya akan mulai dengan perintah dasar. Apakah Anda berencana untuk menggunakan Command Prompt secara ekstensif atau hanya untuk tujuan umum, ini akan berguna.
CLS
Perintah ini cukup menghapus layar Command Prompt. Jika Anda ingin mengosongkan ruang kerja setelah menjalankan terlalu banyak perintah, ini bisa sangat membantu. Yang harus Anda lakukan adalah mengetik cls dan tekan Enter.
Sintaks: cls
Keluar
Jika Anda berencana untuk menutup aplikasi Command Prompt, Anda tidak perlu memindahkan kursor untuk menekan tombol Tutup. Cukup jalankan perintah keluar dan program berhenti.
Anda juga dapat menggunakan parameter/b untuk keluar dari skrip kumpulan yang dimuat. Dengan cara ini, jendela utama tetap terbuka dan hanya file batch yang keluar. Namun, jika Anda menggunakan parameter di luar skrip, aplikasi CMD akan ditutup.
Sintaks: exit/b [kode kesalahan]
di mana kode kesalahan menentukan kode tertentu nomor
Bantuan
Perintah ini masuk berguna jika Anda menemukan perintah apa pun dan ingin mengetahui fungsinya. Ini memberi Anda sintaks bersama dengan parameter yang berbeda (sakelar).
Jika Anda hanya menjalankan bantuan, ini akan menampilkan daftar perintah umum yang digunakan di Prompt Perintah.
Sintaks: bantuan
Namun, tidak semua perintah mendukung utilitas ini. Dalam hal ini, Anda dapat menggunakan/? parameter dan ini harus bekerja untuk setiap perintah.
Sintaks:/?
CD atau CHDIR
Artinya’Ubah Direktori’dan seperti namanya,
Jika Anda hanya menjalankan cd, itu hanya akan menampilkan nama direktori Anda saat ini. Oleh karena itu, penting untuk mempelajari berbagai parameter beserta fungsi dan sintaksnya:
Catatan: perintah chdir dan cd melakukan tindakan yang sama. Jadi, Anda dapat mengubah direktori menggunakan opsi apa pun yang disukai.
Klip
Perintah ini menyalin keluaran yang dijalankan dari perintah tertentu ke papan klip Windows. Dengan cara ini, Anda dapat langsung menyalin data ke program lain mana pun.
Sangat berguna untuk langsung menyalin file teks atau skrip tanpa membukanya. Berikut adalah parameter yang terkait dengannya:
Powercfg
Utilitas Prompt Perintah ini memungkinkan Anda untuk mengontrol pengaturan daya keseluruhan komputer Anda. Perhatikan bahwa jika Anda menggunakannya tanpa parameter yang sesuai, Anda akan menemukan kesalahan”Parameter tidak valid”.
Meskipun ada banyak parameter yang tersedia, saya hanya akan membahas yang paling umum di bawah ini. Jika Anda ingin mempelajari lebih lanjut, cukup jalankan powercfg/?.
Untuk mempelajari perintah di atas secara detail, saya sarankan untuk menjalankan powercfg/? perintah
Misalnya, jika Anda ingin mengetahui lebih banyak tentang parameter/list, Anda dapat menjalankan powercfg/list.
Shutdown
Menariknya, Anda dapat mematikan komputer menggunakan satu perintah di Command Prompt. Juga, dimungkinkan untuk menjadwalkan proses shutdown sesuai keinginan Anda.
Berikut beberapa parameter umum yang mungkin berguna:
Catatan: Menjalankan shutdown tanpa parameter akan menjalankan bantuan atau/? untuk perintah matikan.
Driverquery
Lanjutkan, driver perangkat merupakan komponen integral dari sebuah komputer. Jika Anda mencari informasi tentangnya, kami telah memiliki utilitas Pengelola Perangkat di Windows GUI.
Namun, jika Anda ingin menampilkan informasi driver terperinci saat bekerja pada antarmuka baris perintah, Anda cukup mengetikkan driverquery dan tekan Enter.
Bersamaan dengan itu, Anda dapat menggunakan parameter berikut yang masing-masing memiliki fungsi tersendiri:
Hostname
Perintah ini mencetak nama perangkat. Jika Anda tidak yakin dengan komputer Anda atau mencoba mengidentifikasinya di komputer lain, cukup ketik nama host dan tekan Enter di Command Prompt akan menampilkan hasilnya.
Sintaks: nama host
Info sistem
Tidak seperti perintah hostname , ini akan mencetak informasi terperinci tentang komputer Anda. Pada dasarnya, ini seperti meluncurkan aplikasi Informasi Sistem untuk memeriksa spesifikasi PC Anda.
Selain itu, Anda dapat menggunakan parameter yang sama yang digunakan dalam devicequery (/s,/u,/p,/fo,/nh,/si, dan/v) untuk mencetak keluaran dalam format yang Anda inginkan.
Sintaks: systeminfo [parameter]
Perintah Pemecahan Masalah Windows
Jika Anda menghadapi masalah terkait Windows, mungkin ada ada beberapa penyebabnya—drive rusak, file sistem, image, atau lainnya. Biasanya, menjalankan pemecah masalah dan perintah yang berguna dapat memperbaiki masalah, dan itulah yang akan saya bahas di bagian ini.
CHKDSK
Perintah ini memeriksa disk lokal di komputer dan memberi tahu pengguna tentang kesalahan logis dan fisik . Perhatikan bahwa memperbaiki kesalahan hanya mungkin jika Anda menggunakan parameter berikut dengan bijak.
Di sini, saya hanya membahas yang umum. Namun jika ingin mempelajari lebih lanjut, berikut panduan lengkap cara menjalankan CHKDSK untuk memperbaiki dan memperbaiki harddisk.
SFC
Pemeriksa File Sistem Windows (SFC) membantu Anda memperbaiki file Windows yang rusak. Ini bekerja dengan mengganti file yang rusak dengan salinan yang di-cache, yang bahkan dapat mengoptimalkan kinerja komputer.
Berikut adalah beberapa perintah SFC yang paling sering digunakan:
DISM
Perintah ini memulai alat Layanan dan Pengelolaan Gambar Penerapan untuk mengonfigurasi fitur dan paket gambar Windows. Ada banyak perintah DISM untuk digunakan saat memecahkan masalah Windows, termasuk FFU, WIM, Imaging, dan lainnya. Tapi saya hanya akan membahas parameter umum.
Demi kenyamanan Anda, kami telah menyediakan panduan mendetail untuk menjalankan berbagai perintah DISM.
Kiat Tambahan: Untuk mempelajari lebih lanjut tentang perintah individual, Anda dapat menjalankan perintah/? parameter di akhir. Misalnya, jika Anda ingin mengetahui lebih lanjut tentang/image, cukup jalankan dism.exe/image/?.
msdt.exe-id DeviceDiagnostic
Pemecah masalah Perangkat Keras dan Perangkat tidak lagi tersedia dengan pemecah masalah lain di Pengaturan Windows. Namun, utilitas dapat menemukan dan memperbaiki masalah terkait dengan semua komponen perangkat keras.
Di Windows 11, Anda dapat meluncurkannya menggunakan perintah msdt.exe-id DeviceDiagnostic di Command Prompt.
Perintah Manajemen File dan Direktori
Mengelola file dan direktori di Command Prompt bisa sedikit rumit. Namun demikian, berikut adalah beberapa perintah dasar yang dapat membuat tugas Anda jauh lebih mudah.
DIR
Ini perintah menampilkan semua file dan direktori/subdirektori dari drive/direktori yang ditentukan.
Sebagian besar pengguna menggunakan perintah ini untuk membuat daftar file dan direktori. Ini dimungkinkan dengan hanya menjalankan perintah dir. Bersamaan dengan daftar, itu juga menampilkan label volume, nomor seri, dan jumlah total file dan direktori.
Selain itu, Anda juga dapat menggunakan parameter berikut:
Copy
Seperti namanya, perintah ini menyalin file dari satu lokasi ke lokasi lain. Perhatikan bahwa itu hanya akan membuat duplikat alih-alih memindahkannya.
Sintaks: salin [nama file] [jalur]
Misalnya, untuk menyalin file example.txt dari drive D ke folder Contoh di drive yang sama, berikut perintah saya akan menggunakan:
copy example.txt Contoh
Move
Perintah ini berfungsi dengan cara yang sama seperti copy. Namun, perbedaannya adalah sebenarnya memindahkan file dari satu lokasi ke lokasi lain. Ini pada dasarnya adalah teknik potong dan tempel yang kami gunakan di Windows GUI.
Sintaks: pindahkan [nama file] [jalur]
Misalnya, untuk memindahkan file example.txt dari drive D ke folder Contoh di drive yang sama, berikut adalah perintah yang akan saya gunakan:
move example.txt Contoh
Del atau Erase
Perintah Del dan Erase dapat digunakan untuk menghapus secara permanen file. Artinya, Anda tidak dapat mengambil file kembali dari Recycle Bin.
Sintaks: del [nama file]
Misalnya, untuk menghapus file example.txt secara permanen, berikut perintah yang akan saya jalankan:
del example.txt
Catatan: Meskipun kami belum menentukan parameter dan atribut untuk salin, pindahkan, dan del, Anda dapat mengujinya sendiri menggunakan bantuan atau/? parameter.
MKDIR atau MD
Perintah MKDIR dan MD digunakan untuk membuat direktori (folder) baru. Anda dapat melakukan ini di direktori saat ini atau bahkan di direktori lain secara langsung, artinya Anda tidak perlu pindah ke drive/direktori tertentu untuk membuatnya.
Sintaks: mkdir [path ]\[nama_direktori]
Misalnya, jika saya masuk D drive dan ingin membuat direktori baru, inilah perintah yang akan saya gunakan:
mkdir MyDirectory
Tetapi jika ingin membuat direktori baru di jalur tertentu, inilah yang akan saya jalankan:
mkdir C:\Users\bishu\Desktop\MyDirectory
Rename atau Ren
Perintah Ren atau Rename hanya mengonfigurasi ulang nama file atau direktori. Saat melakukannya, pastikan Anda tidak menduplikasi nama dengan file/direktori lain.
Sintaks: ren [path]/[filename] [new_filename]
Mengambil contoh yang sama seperti di atas, inilah cara saya akan mengganti nama dua file yang telah saya buat sebelumnya:
ren MyDirectory MyDir
ren C:\Users\bishu\Desktop\MyDirectory MyDir
RMDIR atau RD
Itu singkatan dari ‘Hapus Direktori’ dan itulah yang dilakukan oleh perintah. Anda juga dapat menggunakan perintah yang lebih singkat yang melakukan tindakan yang sama–RD.
Berikut adalah semua parameter untuk perintah RMDIR:
Sebagai contoh, saya akan menunjukkan cara menghapus file MyDirectory yang Saya buat sebelumnya:
rmdir MyDir
rmdir C:\Users\bishu\Desktop\MyDir
Ketik
Perintah ini digunakan untuk
Sintaks: ketik [path] [nama file]
Anda dapat melewati [path] jika Anda berada di direktori yang sama dengan file teks.
Asosiasi
Perintah ini digunakan untuk menampilkan atau mengelola asosiasi ekstensi nama file yang berbeda. Perhatikan bahwa Anda memerlukan hak administratif untuk mengubah asosiasi.
Jika Anda hanya menjalankan perintah assoc, utilitas baris perintah mencantumkan semua ekstensi bersama dengan jenis file yang terkait.
Sintaks: assoc
Juga, Anda dapat memeriksa ekstensi file mana yang terkait dengan jenis file individual. Misalnya, Anda dapat mengetahui semua ekstensi yang terkait dengan’sysfile’seperti yang ditunjukkan pada contoh di bawah ini.
Sintaks: assoc | find “[filetype]”
Contoh:assoc | find “sysfile”
Asosiasi juga dapat dimodifikasi. Anda dapat mengaitkan ekstensi file apa pun dengan jenis file apa pun yang Anda inginkan.
Sintaks: assoc=
Contoh: assoc.abc=sysfile
Terakhir, Anda bahkan dapat menghapus asosiasi. Namun, Anda harus me-restart komputer Anda untuk menerapkan perubahan.
Sintaks: assoc [ekstensi]=
Contoh: assoc.abc=
FC
FC adalah singkatan dari “File Compare”dan kedengarannya, ini digunakan untuk membandingkan dua file sehingga Anda dapat mempelajari tentang perbedaan mereka. Seperti yang ditunjukkan dalam demonstrasi di atas, saya telah membandingkan dua file teks untuk mengetahui perbedaan item di dalamnya.
Sintaks: fc [file1] [file2]
Berikut adalah beberapa parameter yang berguna untuk perintah FC:
Attrib
Perintah ini mengelola atribut untuk file dan folder. Anda dapat mengatur atribut apa pun yang Anda inginkan—Hidden, Read-Only, System, dan lainnya. Untuk menyetel atribut, gunakan’+’dan untuk menghapus, gunakan’-‘.
Sintaks: attrib [+/-][attribute_value] [nama file/folder]
Catatan: Saya belum menyebutkan parameter untuk attrib (/s,/d, dan/l). Anda dapat menggunakan/? beralih untuk mempelajari lebih lanjut tentang mereka.
Pohon
Jika Anda ingin untuk melihat subdirektori di dalam direktori atau drive, perintah pohon akan membuatnya terlihat menyenangkan secara grafis. Ini menyusun dokumen dalam format yang mudah dilihat. Yang harus Anda lakukan adalah menjalankan perintah pohon dan menentukan jalur jika diperlukan.
Sintaks: tree [path]
Di bawah ini adalah dua parameter yang dapat Anda adopsi dengan perintah tree:
Perintah Manajemen Disk/Drive
Seiring dengan manajemen file dan direktori, Anda juga dapat mengonfigurasi disk dan drive di Command Prompt.
Berikut adalah 7 perintah yang paling sering digunakan untuk tujuan ini:
Vol
Ini adalah perintah untuk memeriksa nama volume atau nomor seri dengan cepat. Yang harus Anda lakukan adalah mengeksekusi vol dengan huruf drive.
Sintaks: vol [dirve_letter]:
Format
While there already exists easy-to-use GUI applications for formatting your disk drives, it’s never a bad idea to learn this on Command Prompt.
If you want to format a hard drive having just one partition, the format command should work out for you. However, the better option would be using diskpart, which I shall discuss below.
Here, I’ll only mention the common parameters. Nonetheless, you can go through the other guide that should help you format a hard drive from CMD in detail.
Diskpart
This is a command-line interpreter that offers disk management features on Command Prompt. With this utility, you can assign drive letters, manage the drive attributes, configure partitions, display disk information, format a drive, and much more.
Type diskpart and this should launch the interpreter. However, you require administrative privilege to use it.
In the table below, I have mentioned the most used commands in Diskpart. If you wish to learn more about disk partitions using the diskpart command, you can check out our dedicated guides for both HDD and SSD.
Defrag
Defragmentation simply means reorganizing the data inside an HDD to achieve better performance (not recommended on SSD).
Like any other action, Windows already offers a dedicated utility.
However, if you wish to know this in detail, Command Prompt offers tons of parameters that should help you out. Note that this command requires administrative privilege.
Diskusage
This might not be the most used command but is definitely worth it. You can get the summarized details on the selected disk’s usage in no time.
Simply executing the diskusage command should do the job (note that you need to open CMD as an administrator). Along with that, you can take a look at the following parameters that might be beneficial:
Networking Commands
Unlike others, networking commands are widely used mainly for troubleshooting purposes. In fact, fetching IP addresses or configuring network settings is much easier on Command Prompt than using GUI components.
If you’re a networking enthusiast, here are the commands that you need to focus on:
Net
You can use this command to manage different networking services. It comes with multiple options each performing a specialized task.
Here, I’ve only mentioned the most common ones. You can execute the net command without a parameter to get more.
Ipconfig
This command is for network configuration and management. You can view the detailed Windows TCP/IP information, release/renew IP addresses, flush the DNS cache, and much more.
Executing ipconfig without parameters displays the IPv4, IPv6, subnet mask, and default gateway for every adapter. For other purposes, you can adopt the following parameters:
Netsh
This is another essential networking command used for managing network configurations. You can execute netsh to launch the dedicated shell. After that, you can perform desired networking operations using some of the well-known parameters from the below table:
Additional Tip: You can further learn about each of the above command’s arguments using ? in the netsh shell or use the/? parameter with the netsh command.
Netstat
This command lists the active connections on your computer. It displays the protocol, local as well as foreign address, and the current state. Just executing the netstat command will list the active TCP connections.
To display other protocols, here are some parameters you can use:
Ping
This command is widely used for testing host-server reachability and internet connectivity. Executing ping displays the IP address statistics and the approximate round trips in milliseconds.
Here are a few parameters that I recommend trying out:
Tracert
This command traces the route to a certain IP or domain by sending ICMP or ICMPv6 messages with increasing TTL values. It’s extremely useful during network troubleshooting as it informs users about the routing issues and validates the network paths.
Implementing the tracert command without a parameter traces the route of the specified domain/IP over a maximum of 30 hops.
Nevertheless, you could make use of the following parameters to gain additional networking information:
Pathping
This command is a combination of Tracert and Ping. When executed without a parameter, it traces the route to the target over a maximum of 30 hops and computes statistics for 125 seconds (by default).
Here are some of the most used pathping parameters:
Getmac
If you wish to get the MAC address of your computer, you can execute the getmac command and this will display the result in no time. The result includes both the physical address and the transport name.
Along with that, I highly recommend trying out the following parameters:
NSLookUp
This is yet another command-line utility that includes numerous commands to obtain domain name or IP address information. To start the prompt, simply type nslookup in the Command Prompt and hit Enter.
While there are countless parameters for nslookup, I’m only going to focus on a few common ones in the table below:
Miscellaneous
If you have implemented each of the commands I’ve discussed, you should now be proficient enough to use Command Prompt. However, the aforementioned commands are not enough to master this Windows command-line interface.
There are thousands more, and it’s impossible for me to include all of them in this single post.
For now, I would recommend trying out the following commands that could come in handy while you’re on the way to mastering Command Prompt:
Tasklist
You can use this command to display the currently running processes on your computer. Executing tasklist lists down the name of the process, its PID, session name, session number, and memory usage. Also, you can try out the following parameters:
Taskkill
While the tasklist command displays the processes, taskkill kills/ends them. You can use either process ID or image name to do this task. Therefore, you need to utilize any of the following common parameters:
Powershell
If you prefer Windows PowerShell over CMD, you can actually run the Command Prompt as a Powershell window. Just type powershell and hit Enter. You’ll likely get the PS prefix indicating that you can now run all the Powershell cmdlets here.
Syntax: powershell
Set
This command is used for configuring the Windows environment variables. To display all the available ones, you can use the set command without any parameters. In order to set a new environment variable, you can use a variable name and provide the necessary value.
Syntax: set [variable_name]=[value]
Likewise, it’s possible to delete any environment variable too. Below is the syntax that should clear your doubt.
Syntax: set [variable_name]=
The set command on Command Prompt has the following two parameters with individual functionality:
Start
You can use this command to launch a new Command Prompt window. Without the use of any parameter, it will simply launch the new prompt. However, utilizing the following parameters can help you perform just more than that:
BCDBoot
Most users utilize this command to repair the boot environment from the Windows Recovery Environment. It works by copying the Windows installation files to a system partition. You need to execute bcdboot with the following parameters:
Date
This is another useful command to quickly check the current date. You can display or set a new date as per your requirement. If you execute just the date command, the prompt displays the date and asks you to set a new one. But if you quickly want to check the date, use the/t parameter.
Syntax: date/t
Prompt
This command offers customization of the text that appears in front of the cursor (by default, it’s the current directory path).
You can change this to any character string of your choice or predefined characters (like current date, drive, path, times, windows version, etc.) using special codes. You can check using the/? Parameter. To switch back to the normal format, execute the prompt without any parameters.
Syntax: prompt [text/special_code]
Color
Certainly, you have thought of customizing the Command Prompt. To your surprise, it’s possible to tweak the default black (background) and white (foreground/text) combination. For this, you require specifying two hex digits—the first representing the background and the second corresponding to the text.
Syntax: color [hexcode]
As per the above table, let’s say you want a red background with light blue text. So, you’ll have to execute the following command:
color 49
While you’re at it, note that you cannot set the same background and foreground colors. Even if you do it, the command will not execute and you’ll be left with the existing combination.
To switch back to default, run the color command without any parameter.