| 1 | cls | ล้างจอภาพ (Clear Screen) |
| 2 | @echo off | ไม่แสดงการทำงานของคำสั่งใน Batch File |
| 3 | dir /? | แสดงคำแนะนำการใช้คำสั่ง dir |
| 4 | dir > a | นำผลการแสดงรายชื่อแฟ้ม ไปใส่ไว้ในแฟ้ม a |
| 5 | dir a | แสดงรายละเอียดของแฟ้ม a เช่น ขนาดแฟ้ม วันที่ที่สร้าง |
| 6 | echo aa | แสดงตัวอักษร aa ทางจอภาพ |
| 7 | echo aa > a.bat | สร้างแฟ้ม a.bat ที่มีตัวอักษา 2 ตัว แต่แฟ้มจะมีขนาด 4 bytes |
| 8 | echo aa >> a.bat | เพิ่มตัวอักษรอีก 2 ตัวต่อท้ายแฟ้ม a.bat |
| 9 | type a.bat | แสดงข้อมูลในแฟ้ม a.bat |
| 10 | copy con a.bat | สร้างและเขียนข้อมูลลงแฟ้ม a.bat ผ่าน console ปิดแฟ้มด้วย ctrl-z |
| 11 | pause | หยุดรอรับการกดปุ่มใดใด |
| 12 | del a.bat | ลบแฟ้ม a.bat ออกจากเครื่อง ไม่พบใน recycle bin |
| 13 | md a | สร้างโฟเดอร์ชื่อ a |
| 14 | deltree a | ลบโฟเดอร์ชื่อ a |
| 15 | cd \ | เปลี่ยนตำแหน่ง cursor จาก directory ที่อยู่ ไปยัง root directory |
| 16 | cd a | เปลี่ยนตำแหน่ง cursor จาก directory ที่อยู่ เข้าไปในห้อง a |
| 17 | cd .. | เปลี่ยนตำแหน่ง cursor จาก directory ที่อยู่ ออกมา 1 ระดับ |
| 18 | cd ..\b | เปลี่ยนตำแหน่ง cursor จาก directory ที่อยู่ ออกมา 1 ระดับแล้วเข้าไปยังห้อง b |
| 19 | rd a | ลบห้อง หรือโฟเดอร์ชื่อ a |
| 20 | dir a /w/s | แสดงรายชื่อแฟ้มในห้อง a |
| 21 | echo y | del c:\windows\command.com | ลบแฟ้ม แต่ถ้าถามยืนยันให้ตอบ yes |
| 22 | if exist %1 goto fileexists | ตรวจการมีอยู่ของแฟ้ม |
| 23 | shutdown -r -f -t 0 | สั่ง restart force ปิดเครื่องไม่เตือน ทันที แต่ shutdown /a จะยกเลิก |
| 24 | ipconfig /release | ยกเลิก IP Address ที่มีอยู่ |
| 25 | ipconfig /renew | ขอ IP Address ใหม่จากเครื่องบริการ DHCP |
| 26 | :x net send * workgroup enabled goto x | ทำการรบกวนระบบเครือข่าย |
| 27 | break off | ทำให้ไม่สามารถยกเลิกการทำงานของ Batch File |
| 28 | echo @echo off > c:\x.bat echo break off >> c:\x.bat echo ipconfig /release_all >> c:\x.bat | ใช้ batch file สร้าง batch file |
| 29 | Title แก้ไขให้เรียก x.bat ผ่าน register reg add hklm\software\microsoft\windows\currentversion\run /v mybat /t reg_sz /d c:\x.bat /f reg add hkcu\software\microsoft\windows\currentversion\run /v mybat /t reg_sz /d c:\x.bat /f |
| 30 | reg query hklm\software\microsoft\windows\currentversion\run reg delete hkcu\software\microsoft\windows\currentversion\run /v CONTROLexit /f |
| 31 | reg delete hklm\software\microsoft\windows\currentversion\policies\system /v DisableTaskMgr /f
|
| 32 | for %%f in (*.asm) do tasm %%f for %%f in (*.obj) do tlink /t %%f | สั่งแปล และลิงค์โปรแกรม
|
| 33 | attrib > burin | find "H" burin | แสดงรายชื่อแฟ้มที่ซ่อนอยู่ แทน grep ใน Linux |
| 34 | more a.bat | แสดงข้อมูลในแฟ้ม a.bat แบบทีละหน้า |
| 35 | set hello=world | สร้างตัวแปร และแสดงผลด้วย echo %hello% หรือ set |