ชุด ก้อง ไบนารี ตัวเลือก


สวัสดี im พยายามที่จะเก็บไฟล์ไบนารีภายในของชุดแบทช์ขั้นพื้นฐานที่ ive เขียน โดยทั่วไปฉันต้องการสคริปต์เพื่อให้สามารถเอาต์พุตไฟล์ที่สร้างไว้ล่วงหน้านี้ได้ในบางจุดแทนการสร้างจากช่วงเริ่มต้น ถ้าเป็นไปไม่ได้แล้วฉันจะต้องรวมไฟล์นี้แยกต่างหากกับไฟล์ชุดที่จะย้ายไปอยู่ในตำแหน่งที่จำเป็น แต่ Id แทนมีไฟล์นี้มองไม่เห็นผู้ใช้เพื่อให้ดูเหมือนว่าไฟล์จะถูกสร้างขึ้นจากภายใน ชุด ดังนั้นเป็นไปได้นี้และถ้าเป็นเช่นนั้นขอขอบคุณล่วงหน้า ถาม 24 ตุลาคม 2010 ที่ 20: 10WinSCP Free SFTP, SCP และไคลเอ็นต์ FTP สำหรับ Windows ถ้าไม่มีพารามิเตอร์ระบุระบุตัวเลือกสคริปต์ทั้งหมดและค่าของพวกเขา เมื่อมีการระบุพารามิเตอร์อย่างใดอย่างหนึ่งเท่านั้นแสดงค่าของตัวเลือก เมื่อมีการระบุพารามิเตอร์สองค่าจะกำหนดค่าของตัวเลือก ค่าดีฟอลต์ที่แสดงด้านล่างเป็นค่าเริ่มต้นสำหรับแอ็พพลิเคชัน ค่าเริ่มต้นของตัวเลือกบางอย่างอาจแตกต่างกันถ้าคุณแชร์การกำหนดค่าด้วยโหมดกราฟิก ค่าและคำอธิบาย offon สลับการสะท้อนคำสั่งที่กำลังดำเนินการ คำสั่งที่ได้รับผลกระทบ: ทั้งหมดค่าเริ่มต้น: off offonabortcontinue เปิดใช้งานโหมดแบทช์ ในโหมดแบทช์ตัวเลือกใด ๆ จะได้รับการตอบสนองโดยอัตโนมัติและพรอมต์การป้อนข้อมูลใด ๆ จะถูกยกเลิก (หลังจากช่วงเวลาสั้น ๆ ) ในโหมดแบทช์ขอแนะนำให้ตั้งค่ายืนยันให้ปิดเพื่อให้สามารถเขียนทับได้ เมื่อโหมดแบทช์ถูกตั้งไว้ที่ใดก็ได้โดยอัตโนมัติจะตอบปฏิเสธ ยกเว้นกรณีที่มีคำตอบเริ่มต้นแตกต่างกัน (เช่นคำตอบ 8220Reconnect8221 เริ่มต้นสำหรับพรอมต์การเชื่อมต่อใหม่) ในกรณีที่ใช้คำตอบเริ่มต้น (หลังจากช่วงเวลาสั้น ๆ ) ดูตัวเลือกการเชื่อมต่ออีกครั้งด้านล่าง การยกเลิกค่าเป็นเช่นเดียวกับ นอกจากนี้สคริปต์จะถูกยกเลิกเมื่อคำสั่งสคริปต์ใด ๆ ล้มเหลวหรือพรอมต์ใด ๆ ที่ตอบกลับด้วยคำตอบ 8220Abort8221 (หรือคล้ายกัน) เมื่อตั้งค่าให้ดำเนินการใด ๆ ต่อไปจะถูกตอบโดยอัตโนมัติด้วย 8220Skip8221, 8220Ignore8221 หรือคำตอบที่คล้ายกัน การเปิดใช้งานโหมดแบทช์จะกำหนดเวลาเชื่อมต่อใหม่ (ตัวเลือกการเชื่อมต่อใหม่ด้านล่าง) เป็น 120 วินาทีหากยังไม่ได้ตั้งค่า คำสั่งที่ได้รับผลกระทบ: เกือบทั้งหมดค่าเริ่มต้น: ยกเลิกสำหรับคำสั่งที่ระบุโดยใช้สคริปต์หรือคำสั่งปิดสำหรับคำสั่งที่ระบุไว้ในอินพุต ปิดการยืนยัน (เขียนทับ ฯลฯ ) คำสั่งที่ได้รับผลกระทบ: get put Default: ปิดสำหรับคำสั่งที่ระบุโดยใช้สคริปต์หรือคำสั่งสำหรับคำสั่งที่ระบุไว้ใน input off ltsecgt ตั้งค่าขีด จำกัด เวลาเป็นวินาทีเพื่อลองเชื่อมต่อเซสชันเสียใหม่ ค่าปิดจะใช้เวลา จำกัด เวลาเชื่อมต่อใหม่ถูกตั้งไว้โดยไม่ได้ตั้งใจถึง 120 วินาทีเมื่อเปิดใช้งานโหมดแบทช์ (ชุดตัวเลือกข้างต้น) คำสั่งที่ได้รับผลกระทบ: get ใส่ ประสาน keepuptodate ค่าเริ่มต้น: off offon เปิดหรือปิดว่าคำสั่งล้มเหลวหรือไม่เมื่อสัญลักษณ์ใช้เพื่อเลือกไฟล์สำหรับการดำเนินงานไม่ตรงกับไฟล์ใด ๆ คำสั่งที่ได้รับผลกระทบ: get ใส่ RM mv chmod LS lls โปรดสังเกตว่าตัวเลือกไม่ส่งผลต่อการสลับคำนำหน้าของคำสั่ง get and put ค่าเริ่มต้น: ปิดโปรดทราบว่าการรีเซ็ตตัวเลือกเดียวกันจะเขียนทับค่าก่อนหน้านี้จะไม่ผนวกการเขียนสคริปต์ชุดงานอีกต่อไป Windows จะใช้คำสั่ง Windows แบบ 32 บิตที่ใช้กับ Windows รุ่นใหม่ ๆ ตามสภาพแวดล้อมของ Windows NT ไม่ได้กำหนดคำสั่งเฉพาะสำหรับสภาพแวดล้อม DOS และระบบปฏิบัติการ DOS เช่น Windows 95, Windows 98 และ Windows Me ซึ่งผู้แปลคำสั่ง Microsoft จัดหาให้อยู่ในโปรแกรม DOS จริงไม่ใช่โปรแกรม Win32 คุณสามารถดูว่าคุณกำลังเรียกใช้ cmd. exe รุ่นใดโดยใช้คำสั่ง VER หนังสือเล่มนี้อธิบายถึงการใช้ล่ามคำสั่งของ Windows NT วิธีรับแจงและประมวลผลคำสั่งจากผู้ใช้ จากนั้นจะอธิบายคำสั่งต่างๆที่พร้อมใช้งาน เมื่อต้องการดูรายการคำสั่งของ Windows และสรุปสั้น ๆ ให้เปิดพรอมต์คำสั่งบนคอมพิวเตอร์ที่ใช้ Windows และพิมพ์ help เมื่อต้องการค้นหาคำสั่งเฉพาะให้พิมพ์ชื่อของคำสั่งตามด้วย เรื่องของหนังสือเล่มนี้เรียกอีกอย่างหนึ่งว่าการเขียนโปรแกรมแบบแบทช์ถึงแม้แบทช์จะอ้างถึงไฟล์ batch สำหรับ MS DOS และ Windows command interpreter เท่านั้น คำศัพท์อื่น ๆ รวมถึงการเขียนโปรแกรมแบทช์ไฟล์การเขียนสคริปต์ไฟล์แบทช์คำสั่ง batch ของ Windows ไฟล์แบทช์ Windows บรรทัดคำสั่งของ Windows คำสั่ง Windows และการเชลล์ของ Windows การใช้ตัวแปลคำสั่งของ Windows แก้ไขวิธีการตีความคำสั่งบรรทัดคำสั่งการแยกวิเคราะห์บรรทัดคำสั่งลงในลำดับของคำสั่งมีความซับซ้อนและแตกต่างกันอย่างละเอียดจากล่ามคำสั่งไปยังคำสั่ง interpreter อย่างไรก็ตามมีสี่องค์ประกอบหลักคือการทดแทนตัวแปรบรรทัดคำสั่งจะถูกสแกนเพื่อหาข้อกำหนดตัวแปรและพบว่ามีการแทนที่ด้วยเนื้อหาของตัวแปรเหล่านั้น การอ้างอิงอักขระพิเศษสามารถยกมาเพื่อลบความหมายพิเศษของพวกเขา สายคำสั่งไวยากรณ์ถูกพัฒนาขึ้นเป็นลำดับของคำสั่งตามไวยากรณ์ ข้อกำหนดการเปลี่ยนเส้นทางการเปลี่ยนเส้นทางถูกนำมาใช้และนำออกจากบรรทัดคำสั่งก่อนที่จะดำเนินการคำสั่งแต่ละตัวในลำดับ การแทนที่ตัวแปรแก้ไขบรรทัดคำสั่งสามารถมีข้อกำหนดตัวแปรได้ ประกอบด้วยอักขระตามด้วยชื่อตามด้วยอักขระตัวที่สองเว้นเสียแต่ว่าชื่อเป็นตัวเลขใน 0.9 หรือเครื่องหมายดอกจัน ข้อกำหนดตัวแปรจะถูกแทนที่ด้วยค่าต่อไปนี้: varname เช่น PATH หรือ USERNAME จะถูกแทนที่ด้วยค่าของตัวแปรสภาพแวดล้อมที่มีชื่อ ตัวอย่างเช่น PATH จะถูกแทนที่ด้วยค่าของตัวแปรสภาพแวดล้อม PATH n for 0 lt n lt 9 เช่น 0 หรือ 9 ถูกแทนที่ด้วยคือค่าของพารามิเตอร์ n-th ที่ส่งผ่านไปยังไฟล์แบทช์เมื่อถูกเรียกใช้ภายใต้การปรับเปลี่ยนตามมาด้วยคำสั่ง SHIFT ตัวอย่างเช่น: 2 ถูกแทนที่ด้วยค่าของพารามิเตอร์ไฟล์ชุดที่สอง จะถูกแทนที่ด้วยค่าพารามิเตอร์บรรทัดคำสั่งทั้งหมดยกเว้น 0 แม้จะอยู่นอกเหนือดัชนี 9. คำสั่ง SHIFT ไม่มีผลกระทบต่อผลลัพธ์ของ ดูเพิ่มเติมอาร์กิวเมนต์บรรทัดคำสั่ง ชื่อตัวแปรบางชื่อตัวแปรไม่สามารถมองเห็นได้โดยใช้คำสั่ง SET แต่สามารถอ่านได้โดยใช้สัญกรณ์ หากต้องการหาข้อมูลเพิ่มเติมให้พิมพ์ help set ชื่อตัวแปรพิเศษและสิ่งที่พวกเขาขยายไป: ค่าทดแทนการใช้ Quoting และ escaping แก้ไขคุณสามารถป้องกันไม่ให้อักขระพิเศษที่ควบคุมไวยากรณ์คำสั่งมีความหมายพิเศษดังต่อไปนี้ยกเว้นเครื่องหมายเปอร์เซ็นต์ (): คุณสามารถล้อมรอบสตริงที่มีอักขระพิเศษ อักขระโดยใช้เครื่องหมายคำพูด คุณสามารถใส่เครื่องหมายอัญประกาศ () เป็นอักขระหลบหนีก่อนอักขระพิเศษ ในคำสั่งที่อยู่หลังท่อ () คุณจำเป็นต้องใช้ carets 3 อัน () เพื่อให้สามารถทำงานได้ อักขระพิเศษที่ต้องการยกหรือหนีมักเป็น lt, gt, amp และ ในบางสถานการณ์ และอาจต้องหลบหนี บรรทัดใหม่สามารถหลบหนีโดยใช้เครื่องหมายรูปหมวกเช่นกัน เมื่อคุณล้อมรอบสตริงโดยใช้เครื่องหมายคำพูดพวกเขากลายเป็นส่วนหนึ่งของอาร์กิวเมนต์ที่ส่งผ่านไปยังคำสั่งที่เรียกใช้ ในทางตรงกันข้ามเมื่อคุณใช้เครื่องหมายอัญประกาศเป็นตัวหนีข้อมูลเครื่องหมายรูปหมวกจะไม่กลายเป็นส่วนหนึ่งของอาร์กิวเมนต์ที่ส่งผ่าน เครื่องหมายเปอร์เซ็นต์ () เป็นกรณีพิเศษ ในบรรทัดคำสั่งไม่จำเป็นต้องพูดหรือหนีออกไปเว้นแต่จะมีการใช้สองแบบเพื่อระบุตัวแปรเช่น OS แต่ในไฟล์แบทช์คุณต้องใช้เครื่องหมายเปอร์เซ็นต์ () เพื่อให้ได้เครื่องหมายเปอร์เซ็นต์เดียว () การใส่เครื่องหมายคำพูดเปอร์เซ็นต์ในเครื่องหมายคำพูดหรือก่อนหน้านี้ด้วยเครื่องหมายรูปแบบไม่ทำงาน echo Johnson amp son เรียกสายสมบูรณ์แทนที่จะแบ่งบรรทัดคำสั่งที่ตัว amp คำพูดจะสะท้อนและสะท้อนลูกชายแอ็คสันจอห์นสันดังกล่าวข้างต้น แต่ใช้เครื่องหมายรูปหมวกก่อนเครื่องหมายตัวอักษรพิเศษ ไม่มีคำพูดใดที่สะท้อน echo Johnson amp son ไม่ใช้อักขระเลี่ยงและดังนั้นลูกชายถูกตีความว่าเป็นคำสั่งแยกกันโดยปกติแล้วจะนำไปสู่ข้อความแสดงข้อผิดพลาดที่ลูกชายคำสั่งไม่พบ echo A B สะท้อนก. B. Caret ต้องการหลบหนีเช่นกันหรือมิฉะนั้นจะถูกตีความว่าเป็นการหนีออกจากพื้นที่ echo gt NUL echo A B สะท้อนก. เมื่อมีการใช้ท่อแล้วเครื่องหมายจุลภาคที่ใช้สำหรับการหลบหนีจำเป็นต้องเพิ่มเป็น 3 เท่าเพื่อใช้เครื่องหมายที่สี่คือเครื่องหมายที่ถูกหลบหนี ถ้า 1 equ 1 echo Equal amp echo แท้จริงเท่ากับ Echo สองสตริง เครื่องหมายคำเสด็จที่ท้ายบรรทัดจะหนีออกจากบรรทัดใหม่ซึ่งจะนำไปสู่สามบรรทัดที่ถือว่าเป็นเส้นเดียว ช่องว่างก่อนเครื่องหมายรูปที่ 1 เป็นสิ่งที่จำเป็นหรือมิฉะนั้นจะถูกรวมเข้าด้วยเสียงก้องดังต่อไปนี้เพื่อให้ได้ 1echo attrib File 1.txt ไม่แสดงแอตทริบิวต์ของไฟล์ชื่อ File 1.txt เนื่องจากการหนีข้อมูลไม่ทำงาน การใช้เครื่องหมายคำพูดเช่นเดียวกับในไฟล์ 1.txt การทำงาน echo อัตราส่วนคือ 47 ถ้าใช้จากชุดเครื่องหมายเปอร์เซ็นต์จะถูกละเว้น echo อัตราส่วนคือ 47 ถ้าใช้จากแบทช์เครื่องหมายเปอร์เซ็นต์จะถูกส่งออกเพียงครั้งเดียว set a modulo143 ถ้ารันจากแบทช์ให้ตั้งตัวแปร modulo เป็น 2 ส่วนที่เหลือจะหารด้วย 14 โดย 3. ไม่ทำงานกับ single สำหรับ i in (1,2,3) do echo i หากรันจากแบทช์ผลลัพธ์ 1, 2 และ 3 echo temp จะแสดงเนื้อหาของตัวแปร temp แม้ว่าจะรันจากไฟล์แบทช์ก็ตาม การใช้เครื่องหมายเปอร์เซ็นต์ในแบทช์เพื่อเข้าถึงตัวแปรสภาพแวดล้อมและอาร์กิวเมนต์ที่ส่งผ่านจะต้องไม่มีการหลบหนี echo temp แสดงผลตามตัวอักษรเมื่อเรียกใช้จากบรรทัดคำสั่ง echo temp เอาท์พุทจะทำงานอย่างแท้จริงเมื่อทำงานจากแบทช์ echo comment line findstr คำสั่ง FINDSTR ใช้เครื่องหมายแบ็กสแลช () เพื่อหลบหนี ซึ่งแตกต่างจาก caret ซึ่งอยู่ภายในคำสั่งและไม่รู้จักกับ shell คำสั่ง ไวยากรณ์แก้ไขบรรทัดรับคำสั่งได้รับการพัฒนาเป็นลำดับของคำสั่งตามไวยากรณ์ ในไวยากรณ์คำสั่งง่ายๆอาจรวมกันเพื่อสร้างท่อ ซึ่งอาจจะรวมกันเพื่อสร้างคำสั่งผสม ซึ่งท้ายที่สุดอาจจะกลายเป็นคำสั่งในวงเล็บ คำสั่งง่ายๆคือชื่อคำสั่งหางคำสั่งและข้อกำหนดการเปลี่ยนเส้นทางบางอย่าง ตัวอย่างของคำสั่งง่ายๆคือ dir. txt gt somefile ท่อเป็นคำสั่งง่ายๆหลายตัวรวมเข้ากับ metacharacter ท่อหรือที่เรียกว่าแถบแนวตั้ง เอาท์พุทมาตรฐานของคำสั่งง่ายๆก่อนแถบแนวตั้งแต่ละตัวจะเชื่อมต่อกับอินพุตมาตรฐานของคำสั่งง่ายๆต่อไปนี้ผ่านทางท่อ ตัวแปลคำสั่งรันคำสั่งง่ายๆทั้งหมดในท่อแบบคู่ขนาน ตัวอย่างของท่อ (ประกอบด้วยสองคำสั่งง่ายๆ) คือ dir. txt เพิ่มเติม คำสั่งผสมคือชุดของท่อที่คั่นด้วยคำสันธาน ท่อจะดำเนินการตามลำดับหลังจากที่อื่นและร่วมควบคุมว่าคำสั่งล่ามดำเนินการท่อต่อไปหรือไม่ ตัวอย่างของคำสั่งผสม (ประกอบไปด้วยท่อสองท่อซึ่งเป็นคำสั่งง่ายๆ) คือย้ายไฟล์ file. txt file. bak ampamp dir gt file. txt แอมป์ - ไม่มีเงื่อนไขร่วม ท่อต่อไปจะดำเนินการอยู่เสมอหลังจากที่ระบบปฏิบัติการปัจจุบันดำเนินการเสร็จสิ้นแล้ว ampamp - บวกเงื่อนไขร่วม ท่อต่อไปจะถูกเรียกใช้ถ้าระบบปัจจุบันดำเนินการเสร็จสิ้นโดยมีสถานะการออกเป็นศูนย์ - เงื่อนไขร่วมเชิงลบ ท่อต่อไปจะถูกเรียกใช้ถ้าระบบปัจจุบันดำเนินการเสร็จสิ้นโดยมีสถานะทางออกที่ไม่ใช่ศูนย์ คำสั่งในวงเล็บคือคำสั่งผสมที่อยู่ในวงเล็บ (เช่น (และ)) จากมุมมองของไวยากรณ์คำสั่งนี้จะเปลี่ยนคำสั่งผสมให้เป็นคำสั่งง่ายๆซึ่งสามารถนำการส่งออกโดยรวมได้ ตัวอย่างเช่นบรรทัดคำสั่ง (pushd temp amp dir amp) gt somefile เป็นสาเหตุให้เอาต์พุตมาตรฐานของคำสั่ง compound ทั้งหมด (pushd temp amp dir amp popd) เพื่อเปลี่ยนเส้นทางไปยัง somefile Redirection Redirection ข้อกำหนดการเปลี่ยนเส้นทางถูกนำมาใช้และนำออกจากบรรทัดคำสั่งก่อนที่จะดำเนินการคำสั่งแต่ละคำในลำดับ ข้อกำหนดการเปลี่ยนเส้นทางจะควบคุมที่อินพุตมาตรฐานเอาต์พุตมาตรฐานและไฟล์ข้อผิดพลาดมาตรฐานสำหรับจุดสั่งงานแบบง่าย จะแทนที่ผลกระทบใด ๆ กับไฟล์ที่จัดการซึ่งอาจเป็นผลมาจากการวางท่อ (ดูส่วนก่อนหน้าในไวยากรณ์คำสั่ง) เครื่องหมายการเปลี่ยนเส้นทาง gt และ gtgt สามารถนำหน้าด้วย 1 สำหรับเอาต์พุตมาตรฐาน (เช่นเดียวกับไม่มีคำนำหน้า) หรือ 2 สำหรับข้อผิดพลาดมาตรฐาน ข้อกำหนดการเปลี่ยนเส้นทางคือ: lt filename เปลี่ยนเส้นทางอินเทอร์เฟซมาตรฐานเพื่ออ่านจากไฟล์ที่ตั้งชื่อ gt filename เปลี่ยนเส้นทางเอาต์พุตมาตรฐานเพื่อเขียนไปยังไฟล์ที่ตั้งชื่อแทนที่เนื้อหาก่อนหน้า gtgt filename เปลี่ยนเส้นทางเอาต์พุตมาตรฐานเพื่อเขียนไปยังไฟล์ที่ระบุและต่อท้ายส่วนท้ายของเนื้อหาก่อนหน้า gtamp h เปลี่ยนเส้นทางเพื่อจัดการกับ h ที่จับเป็น input 0standard output มาตรฐาน 1 ข้อผิดพลาด 2 มาตรฐานและอื่น ๆ เปลี่ยนจากแฮนเดิล h dir. txt gtlisting. log เปลี่ยนเส้นทางผลลัพธ์ของคำสั่ง dir ไปยังไฟล์ listing. log dir. txt gt listing. log ด้านบนช่องว่างก่อนชื่อไฟล์ไม่ต่างกัน อย่างไรก็ตามหากคุณพิมพ์ข้อความนี้ลงในหน้าต่างคำสั่งการทำงานอัตโนมัติด้วยแท็บหลังจากพิมพ์ gt l จะใช้งานได้จริงในขณะที่ไม่ทำงานกับ gtlisting. log dir. txt 2gtNUL เปลี่ยนเส้นทางข้อผิดพลาดของคำสั่ง dir ไปที่ใดก็ได้ dir. txt gtgtlisting. log เปลี่ยนเส้นทางการแสดงผลของคำสั่ง dir ไปยังไฟล์ listing. log, ผนวกเข้ากับไฟล์ ด้วยเหตุนี้เนื้อหาของไฟล์ก่อนที่คำสั่งที่เปลี่ยนเส้นทางจะถูกเรียกใช้งานไม่ได้หายไป dir. txt gtlisting. log 2gtamp1 เปลี่ยนเส้นทางผลลัพธ์ของคำสั่ง dir ไปยังไฟล์ listing. log พร้อมกับข้อความแสดงข้อผิดพลาด dir. txt gtlisting. log 2gtlisting-errors. log เปลี่ยนเส้นทางผลลัพธ์ของคำสั่ง dir ไปที่ไฟล์ listing. log และข้อผิดพลาดในไฟล์ listing-errors. log gtmyfile. txt echo Hello การเปลี่ยนเส้นทางสามารถนำหน้าคำสั่งได้ echo Hello amp echo World gtmyfile. txt เฉพาะ echo ที่ 2 เท่านั้นที่ได้รับการเปลี่ยนเส้นทาง (echo Hello amp echo World) gtmyfile. txt ผลลัพธ์ของ echos ทั้งสองถูกเปลี่ยนเส้นทาง type con gtmyfile. txt เปลี่ยนเส้นทางคอนโซลข้อมูล (con) ไปยังไฟล์ ดังนั้นจึงยอมให้ผู้ใช้หลายบรรทัดถูกยกเลิกโดยผู้ใช้กด Control Z ดูข้อมูลผู้ใช้ (สำหรับ i in (1,2,3) do echo i) gt myfile. txt เปลี่ยนเส้นทางเอาต์พุตทั้งหมดของลูปไปที่ไฟล์ สำหรับ i in (1,2,3) do echo i gt myfile. txt เริ่มต้นการเปลี่ยนเส้นทางใหม่ทุกครั้งที่มีการป้อนเนื้อที่ของลูปเอาต์พุตการวนซ้ำทั้งหมดของ loop ทั้งหมด คำสั่งทำงานอย่างไร Edit Batch reloading แก้ไขคำสั่ง interpreter จะโหลดเนื้อหาของแบทช์หลังจากการดำเนินการของแต่ละบรรทัดหรือกลุ่มวงเล็บ ถ้าคุณเริ่มต้นแบทช์ต่อไปนี้และเปลี่ยน echo A เพื่อสะท้อน B ในแบทช์ไม่นานหลังจากที่เริ่มต้นเอาต์พุตจะเป็น B สิ่งที่อยู่ในบรรทัดเดียวไม่เกี่ยวกับการเปลี่ยน echo A ในชุดแบทช์ต่อไปนี้หลังจากที่รันจะไม่มีผลกระทบใด ๆ : มีการเปลี่ยนแปลงหลังจากเริ่มต้นมีผลกระทบใด ๆ กับคำสั่งที่มีวงเล็บด้วย (และ) ดังนั้นการเปลี่ยน echo A หลังจากสตาร์ทชุดต่อไปนี้ไม่มีผลใด ๆ : Ditto สำหรับการปิดล้อมอื่น ๆ รวมถึงตัวแปรแวดล้อมนี้ตัวแปรสภาพแวดล้อมของกระบวนการล่ามคำสั่งจะสืบทอดมาจากกระบวนการของคำสั่งภายนอกใด ๆ ที่มันรัน ตัวแปรสภาพแวดล้อมบางตัวถูกใช้โดย interpreter คำสั่งเอง การเปลี่ยนแปลงจะเปลี่ยนการทำงาน ตัวแปรสภาพแวดล้อมได้รับผลกระทบจากตลาดหลักทรัพย์ฯ เส้นทาง. และคำสั่ง PROMPT หากต้องการยกเลิกการตั้งค่าตัวแปรให้ตั้งค่าเป็นสตริงที่ว่างเปล่าเช่น myvar ชุด ล่ามคำสั่งสืบทอดตัวแปรชุดแรกของตัวแปรแวดล้อมจากกระบวนการที่สร้างขึ้น ในกรณีที่คำสั่ง interpers เรียกจากทางลัดเดสก์ทอปนี้จะเป็น Windows Explorer เช่น ล่ามคำสั่งโดยทั่วไปมีอินเทอร์เฟซสำหรับผู้ใช้แบบข้อความไม่ใช่แบบกราฟิกและดังนั้นจึงไม่รู้จักข้อความ Windows ที่แจ้งแอพพลิเคชันที่แม่แบบตัวแปรสภาพแวดล้อมในรีจิสทรีได้รับการเปลี่ยนแปลง การเปลี่ยนตัวแปรสภาพแวดล้อมใน 'แผงควบคุม' จะทำให้ Windows Explorer ทำการปรับปรุงตัวแปรสภาพแวดล้อมของตนเองจากเทมเพลตในรีจิสทรีและด้วยเหตุนี้การเปลี่ยนแปลงตัวแปรสภาพแวดล้อมที่เรียกใช้ตัวแปลคำสั่งต่อจากนั้นจะสืบทอด อย่างไรก็ตามจะไม่ทำให้โปรแกรมแปลคำสั่งทำงานอยู่แล้วเพื่ออัพเดตตัวแปรสภาพแวดล้อมของตนจากเทมเพลตใน Registry COMSPEC แก้ไขตัวแปรสภาพแวดล้อม COMSPEC ประกอบด้วยพา ธ เต็มของไฟล์โปรแกรมล่ามคำสั่ง นี่เป็นเพียงกรรมพันธุ์ที่ได้รับจากกระบวนการแม่ดังนั้นจึงได้รับมาโดยอ้อมจากการตั้งค่า COMSPEC ในเทมเพลตตัวแปรสภาพแวดล้อมใน Registry ค่าของตัวแปรสภาพแวดล้อมของเส้นทางประกอบด้วยรายการชื่อไดเรกทอรีที่คั่นด้วยอักขระกึ่งลำไส้ใหญ่ นี่คือรายการไดเรกทอรีที่ค้นหาตามลำดับเมื่อค้นหาไฟล์โปรแกรมของคำสั่งภายนอกที่จะดำเนินการ PATHEXT แก้ไขค่าของตัวแปรสภาพแวดล้อม PATHEXT ประกอบด้วยรายการของนามสกุลของชื่อไฟล์คั่นด้วยอักขระกึ่งลำไส้ใหญ่ นี่คือรายการของนามสกุลของชื่อไฟล์ที่ถูกใช้ตามลำดับเมื่อค้นหาไฟล์โปรแกรมของคำสั่งภายนอกเพื่อดำเนินการ เนื้อหาตัวอย่างของ PATHEXT ที่พิมพ์โดย echo PATHEXT: ด้วยการเพิ่ม. PL ลงในตัวแปรคุณสามารถมั่นใจได้ว่าโปรแกรม Perl จะรันจากบรรทัดคำสั่งแม้ว่าจะพิมพ์โดยไม่มีนามสกุล. pl ก็ตาม ดังนั้นแทนที่จะพิมพ์ b. txt my. diff. pl a. txt คุณสามารถพิมพ์ mydiff a. txt b. txt การเพิ่ม. PL ไปยังตัวแปรใน Windows Vista และใหม่กว่า: setx PATHEXT PATHEXT. PL ถ้าคุณใช้ชุดที่มีอยู่ใน Windows XP ผลจะเป็นผลชั่วคราวและส่งผลต่อคอนโซลหรือกระบวนการปัจจุบันเท่านั้น PROMPT Edit ตัวแปรสภาพแวดล้อม PROMPT ควบคุมข้อความที่ปล่อยออกมาเมื่อล่ามคำสั่งแสดงพรอมต์ คำสั่ง interpreter จะแสดงพรอมต์เมื่อแจ้งให้บรรทัดคำสั่งใหม่ในโหมดโต้ตอบหรือเมื่อสะท้อนบรรทัดไฟล์แบทช์ในโหมดไฟล์แบทช์ ลำดับของอักขระพิเศษต่างๆในค่าของตัวแปรสภาพแวดล้อม PROMPT ทำให้เกิดลักษณะพิเศษต่างๆเมื่อมีการแสดงพรอมต์ดังที่แสดงในตารางต่อไปนี้: สวิตช์แก้ไขคำสั่งของ Windows ส่วนใหญ่จะให้ตัวเลือก AKA สวิทซ์เพื่อกำหนดพฤติกรรมของตนเอง สวิทช์ส่วนใหญ่ประกอบด้วยสวิทช์ตัวเดียวที่มีลำดับตัวอักษรหลายตัว สวิตช์ถูกนำหน้าด้วยเครื่องหมายทับ () มากกว่าในบางระบบปฏิบัติการอื่นโดยใช้เครื่องหมายลบ (-) สวิตช์เป็นแบบไม่คำนึงถึงตัวพิมพ์ใหญ่มากกว่าในบางระบบปฏิบัติการอื่น ๆ เช่น case-sensitive ถ้าคำสั่งจากระบบปฏิบัติการอื่นถูกย้ายไปที่ Windows (เช่น grep) ระบบจะเก็บรักษาตัวเลือกอื่น ๆ จากระบบปฏิบัติการเดิมรวมทั้งการใช้เครื่องหมายลบและ case-sensitive dir แสดงความช่วยเหลือ ตัวเลือกนี้มีไว้สำหรับคำสั่งต่างๆ dir b s แสดงรายการไฟล์และโฟลเดอร์ทั้งหมดในโฟลเดอร์ปัจจุบันในแบบ recursively ใช้สวิตช์สองตัว: b และ s dir bs ไม่สามารถใช้สวิตช์ได้หลังเครื่องหมายทับเดียว findstr ric: id: 0-9 File. txt ไม่เหมือนกับคำสั่งอื่น ๆ findstr ช่วยให้การสะสมของสวิทช์อยู่หลังเครื่องหมายทับ อันที่จริง r, i และ c เป็นสวิตช์ตัวอักษรเดียว dirbs Works ใน dir การลบช่องว่างระหว่างคำสั่งและสวิตช์แรกหรือระหว่างสวิทช์จะไม่ทำให้เกิดความแตกต่างดังนั้นจึงเหมือนกับ dir b s treefa ไม่ทำงานแตกต่างจากต้นไม้ f a. ในต้นไม้การแบ่งแยกด้วยช่องว่างเป็นข้อบังคับ การทำงาน findiv ยังไม่ dir od จดหมายสวิตซ์ o จะได้รับการแก้ไขเพิ่มเติมโดยใช้ตัวอักษรเดียวที่ระบุว่าการสั่งซื้อควรเป็นไปตามวันที่ ตัวอักษร d ไม่ได้เปลี่ยนด้วยตัวเอง กรณีที่คล้ายกัน ได้แก่ โฆษณา dir และ t4 เพิ่มเติม dir B S สวิทช์เป็นแบบไม่คำนึงถึงตัวพิมพ์ใหญ่ซึ่งแตกต่างจากในระบบปฏิบัติการอื่น ๆ เรียงไฟล์ r. txt จัดเรียงไฟล์ตามลำดับย้อนกลับ sort sort file. txt ย้อนกลับช่วยให้สตริงสวิทซ์ยาวกว่าตัวอักษรเดียว sort reve file. txt Sort ช่วยให้สตริงสวิทซ์ที่ระบุเป็นสตริงย่อยของชื่อยาวที่สมบูรณ์ของสวิตช์ ดังนั้นไม่เหมือนกับข้างต้น sort reva file. txt ไม่ทำงานเนื่องจาก reva ไม่ใช่สายอักขระย่อย taskkill im AcroRd32.exe Taskkill ต้องการเปลี่ยนชื่อ multiletter สำหรับ im shortening ไป i ไม่ทำงาน java - รุ่น Java ซึ่งมาในสภาพแวดล้อมของตระกูลระบบปฏิบัติการอื่น ๆ ใช้แนวคิดลบสำหรับสวิตช์ AKA options grep --help ถ้าติดตั้ง grep GNU ต้องใช้สวิทช์หลายตัวก่อนหน้าด้วยเครื่องหมายขีดกลางสองขีด ระดับข้อผิดพลาดคำสั่งแก้ไขมักกำหนดระดับข้อผิดพลาดเมื่อสิ้นสุดการทำงาน ใน Windows NT และใหม่กว่าเป็นจำนวนเต็ม 32 บิตที่ลงนามใน MS DOS ใช้เป็นจำนวนเต็มตั้งแต่ 0 ถึง 255 คำสำคัญ: รหัส Return, รหัสทางออก, สถานะออก ความหมายทั่วไปของระดับข้อผิดพลาด: 0 - ความสำเร็จไม่ใช่ 0 - ล้มเหลวระดับความผิดพลาดที่ตั้งไว้มักเป็นบวก ถ้าคำสั่งไม่ได้แยกความแตกต่างของความล้มเหลวระดับความผิดพลาดเกี่ยวกับความล้มเหลวมักเป็น 1 การใช้ระดับความผิดพลาด: สามารถทดสอบโดยใช้ ampamp และดูไวยากรณ์ สามารถทดสอบโดยใช้ IF ค่าสามารถเข้าถึงได้จากตัวแปร ERRORLEVEL dir gtnul ampamp echo ความสำเร็จส่วนหลัง ampamp จะทำงานเฉพาะเมื่อระดับความผิดพลาดเป็นศูนย์เท่านั้น สี 00 echo Failure ส่วนที่หลังจากใช้งานได้ก็ต่อเมื่อระดับความผิดพลาดไม่ใช่ศูนย์บวกหรือลบ color 00 (echo Failure) การถ่ายคร่อม multiline ทำงานได้ดี echo ERRORLEVEL แสดงระดับข้อผิดพลาดโดยไม่ต้องเปลี่ยน ถ้า errorlevel equ 0 echo ระดับความผิดพลาดคือศูนย์ซึ่งหมายถึงความสำเร็จ ถ้า errorlevel neq 0 echo ระดับข้อผิดพลาดไม่ใช่ศูนย์หมายถึงความล้มเหลว หาก errorlevel 1 echo ระดับความผิดพลาดคือ gt 1 หมายถึงความผิดพลาดในระดับความผิดพลาดในเชิงบวก ไม่ครอบคลุมความล้มเหลวผ่านระดับข้อผิดพลาดเชิงลบ หมายเหตุ: ส่วน gt: นี่ไม่ใช่เช่นเดียวกับถ้า errorlevel equ 1. exit b 1 ส่งกลับไฟล์แบทช์กำหนดระดับข้อผิดพลาดเป็น 1.cdc exit b 10 ในช่วงกลางของไฟล์แบทช์หรือบนบรรทัดคำสั่งให้ตั้งค่า ระดับความผิดพลาดที่ 10 (ออกจาก cmd c 0 ampamp Echo Success) amp (cmd c ทางออก b -1 Echo Failure) ดังที่ได้กล่าวมาแล้ว (cmd c ทางออก b 0 amp cmd c ทางออก b 1) Echo Failure ระดับความผิดพลาดของสายโซ่ที่สร้างขึ้นโดย amp คือระดับความผิดพลาดของคำสั่งสุดท้ายของ chain cmd c exit b -1 amp ถ้าไม่ errorlevel 1 echo ความสำเร็จจะเกิดขึ้น test ถ้าไม่ errorlevel 1 ซึ่งอาจดูเหมือนจะทดสอบเพื่อความสำเร็จส่งผ่านไปยังหมายเลขลบ: มันทดสอบที่ระดับความผิดพลาดไม่ gt 1 ซึ่งเป็นระดับความผิดพลาด lt 0. ตั้งค่า myerrorlevelerrorlevel จำระดับข้อผิดพลาดในภายหลัง set errorlevel0 เพื่อหลีกเลี่ยง: overshadows ตัวแปร errorlevel ในตัว มั่นใจได้ว่าการเข้าถึงที่ผ่านมาผ่านทาง ERRORLEVEL จะส่งกลับ 0 แทนระดับความผิดพลาดที่เกิดขึ้นจริง cmd c ทางออก b 0 ถ้า 1 equ 1 (cmd c ทางออก b 1 amp echo errorlevel) แสดง 0 เนื่องจาก errorlevel ถูกขยายก่อนที่ cmd c exit b 1 จะทำงาน การประมวลผลสตริงการแก้ไขสตริงย่อยของตัวแปรตามตำแหน่งและความยาว: ก่อนใช้ตัวอย่างต่อไปนี้ให้ตรวจสอบให้แน่ใจว่าเท่ากับ ABCD โดยการใช้งานนี้: f9 ใช้พื้นหลังสีขาวและสีน้ำเงินเบื้องหน้า color เรียกคืนการตั้งค่าสีเดิม คัดลอกไฟล์ ดูเพิ่มเติม MOVE คัดลอก F: File. txt คัดลอกไฟล์ลงในไดเร็กทอรีปัจจุบันสมมติว่าไดเร็กทอรีปัจจุบันไม่ใช่ F :. คัดลอก F: My File. txt เป็นเครื่องหมายคำพูดข้างต้นเป็นสิ่งจำเป็นเพื่อล้อมรอบไฟล์ที่มีช่องว่าง สำเนา F:.txt สำเนาไฟล์ที่อยู่ที่ F: และลงท้ายด้วย dot txt ลงในไดเร็กตอรี่ปัจจุบันสมมติว่าไดเรกทอรีปัจจุบันไม่ใช่ F :. คัดลอก F:.txt ไม่เหมือนกับคำสั่งข้างต้น คัดลอก File. txt ปัญหาข้อความแสดงข้อผิดพลาดเนื่องจาก File. txt ไม่สามารถคัดลอกไปเองได้ คัดลอก File1.txt File2.txt สำเนา File1.txt เป็น File2.txt การเขียนทับไฟล์ File2.txt หากได้รับการยืนยันโดยผู้ใช้หรือหากรันจากสคริปต์แบทช์ คัดลอก File. txt ไดเรกทอรีของฉันคัดลอกไฟล์ File. txt ลงในไดเร็กทอรี My Directory โดยสมมติว่า My Directory อยู่ คัดลอก Dir1 Dir2 คัดลอกไฟล์ทั้งหมดที่อยู่โดยตรงในไดเร็กทอรี Dir1 ลงใน Dir2 โดยสมมติว่า Dir1 และ Dir2 เป็นไดเร็กทอรี ไม่คัดลอกแฟ้มที่อยู่ในไดเรกทอรีที่ซ้อนกันของ Dir1 copy. txt. bak สำหรับแต่ละไฟล์. txt ในโฟลเดอร์ปัจจุบันทำให้สำเนาที่ลงท้ายด้วย bak แทนที่จะเป็น txt ลบไฟล์ ใช้ด้วยความระมัดระวังโดยเฉพาะอย่างยิ่งเมื่อใช้ร่วมกับอักขระตัวแทน ลบเฉพาะไฟล์ไม่ใช่ไดเร็กทอรีซึ่งดู RD สำหรับข้อมูลเพิ่มเติมให้พิมพ์ del del File. txt del s. txt ลบไฟล์ที่ทำซ้ำรวมทั้งไดเรกทอรีที่ซ้อนกันอยู่ แต่จะช่วยให้ไดเรกทอรีลบไฟล์ที่ตรงกันทั้งหมดโดยไม่ต้องขอการยืนยัน del p s. txt ด้านบน แต่ขอยืนยันก่อนไฟล์ทุกไฟล์ แสดงเนื้อหาของไดเร็กทอรี มีตัวเลือกมากมาย พิมพ์ dir เพื่อรับความช่วยเหลือเพิ่มเติม dir แสดงรายการไฟล์และโฟลเดอร์ในโฟลเดอร์ปัจจุบันโดยยกเว้นไฟล์ที่ซ่อนและไฟล์ระบบใช้รูปแบบที่แตกต่างกันในการแสดงรายการถ้าตัวแปร DIRCMD ไม่ว่างเปล่าและมีสวิทช์สำหรับ dir dir d: dir b C: ผู้ใช้ dir s แสดงเนื้อหาของไดเรกทอรีและไดเรกทอรีย่อยทั้งหมดที่ทำซ้ำ dir s b แสดงเนื้อหาของไดเร็กตอรี่และไดเรกทอรีย่อยทั้งหมดที่ทำซ้ำหนึ่งไฟล์ต่อบรรทัดแสดงเส้นทางที่สมบูรณ์สำหรับแต่ละไฟล์หรือไดเรกทอรีที่ระบุ dir. txt แสดงรายการไฟล์ทั้งหมดที่มีนามสกุล. txt dir a รวมไฟล์ที่ซ่อนไว้และไฟล์ระบบในรายชื่อ dir ah แสดงไฟล์ที่ซ่อนไว้เท่านั้น dir ad แสดงไดเรกทอรีเท่านั้น ตัวอักษรอื่น ๆ หลังจาก A รวม S, I, R, A และ L. dir ahd แสดงไดเรกทอรีที่ซ่อนไว้เท่านั้น dir a-d แสดงรายการไฟล์เท่านั้นละเว้นไดเรกทอรี dir a-d-h แสดงไฟล์ที่ไม่ได้ซ่อนเฉพาะละเว้นไดเรกทอรี dir od จัดเรียงไฟล์และโฟลเดอร์ตามวันที่แก้ไขครั้งล่าสุด ตัวอักษรอื่น ๆ หลังจาก O รวม N (ตามชื่อ), E (โดยส่วนขยาย), S (ตามขนาด) และ G (โฟลเดอร์แรก) dir o-s จัดเรียงไฟล์ตามขนาดที่ลดลงตามผลกระทบต่อลำดับของโฟลเดอร์ไม่ชัดเจน dir - c o-s a-d แสดงรายการไฟล์ที่เรียงลำดับตามขนาดจากมากไปน้อยโดยไม่ต้องใส่คั่นด้วยเครื่องหมายพันโดยไม่รวมโฟลเดอร์ dir s b od แสดงรายการเนื้อหาของไดเรคทอรีและไดเรกทอรีย่อยทั้งหมดตามลำดับการสั่งซื้อไฟล์ในแต่ละไดเร็กทอรีตามวันที่แก้ไขครั้งล่าสุด การสั่งซื้อจะเกิดขึ้นเฉพาะในแต่ละไดเร็กทอรีชุดข้อมูลทั้งหมดที่พบดังนั้นจึงไม่ได้รับคำสั่งโดยรวม dir a s แสดงรายการไฟล์ที่ซ้ำรวมทั้งไฟล์ที่ซ่อนและไฟล์ระบบ สามารถใช้เพื่อหาการใช้ดิสก์ (ขนาดไดเร็กทอรี) โดยการพิจารณาบรรทัดสุดท้ายของเอาท์พุท แสดงหรือตั้งวันที่ วิธีแสดงวันที่ขึ้นอยู่กับการตั้งค่าประเทศ วันที่สามารถแสดงโดยใช้ echo DATE วันที่ในรูปแบบ ISO เช่น 2000-01-28: ไม่มีที่ไหนทำได้ง่ายเนื่องจากรูปแบบวันที่ขึ้นอยู่กับการตั้งค่าประเทศ ถ้าคุณสามารถสันนิษฐานได้ว่าเป็นรูปแบบของ Mon 01282000 สิ่งต่อไปนี้จะทำ: set isodatedate: 7,2 ถ้าคุณมี WMIC ต่อไปนี้คือตำแหน่งที่ตั้งที่เป็นอิสระ: สำหรับ fi in (wmic os get localDateTime) จะทำอย่างไรถ้า i lss ถ้า i gtr set set localdti isodatelocaldt: 6,2 หากต้องการใช้ข้างต้นเป็นแบทช์ให้เปิด i ไปที่ i และลบออกจากก่อน if หากคุณติดตั้ง Perl ไว้: สำหรับ fi in (perl - MPOSIX - le พิมพ์ strftime Y-m-d, localtime) isodatei แสดงข้อความหรือเปลี่ยนคำสั่งเป็น echoing หรือ off echo echo off echo Hello echo hello แสดงคำพูดด้วย echo PATH แสดงเนื้อหาของตัวแปร PATH echo เจ้าของแอมป์บุตรใช้เครื่องหมายดอกจัน () เพื่อหลบหนีเครื่องหมาย (Amplit) ซึ่งจะทำให้สามารถสะท้อนความหมายของ Ampersands echo 1ampecho 2ampecho 3 แสดงสามสายแต่ละบรรทัดตามด้วยบรรทัดใหม่ เสียงสะท้อน ส่งออกบรรทัดใหม่ในขณะที่ระยะเวลาไม่ได้แสดงผล หากไม่มีระยะเวลาเอาท์พุตจะปิดก้องหรือเปิดเสียงสะท้อน การเพิ่มช่องว่างก่อนระยะเวลาจะนำไปสู่ช่วงที่กำลังแสดงผล อักขระอื่น ๆ ที่มีผลเช่นเดียวกับช่วงรวม:, (echo randomgtgtMyRandomNumbers. txt ในขณะที่ดูเหมือนว่าจะส่งออกตัวเลขสุ่มไป MyRandomNumbers. txt ก็จริงไม่ได้ทำสำหรับตัวเลข 0-9 ตั้งแต่เหล่านี้เมื่อวางไว้ก่อน gtgt ระบุ ช่องที่จะเปลี่ยนเส้นทางโปรดดูการเปลี่ยนเส้นทางอีกครั้ง echo 2gtgtMyRandomNumbers. txt แทนการสะท้อน 2 เปลี่ยนเส้นทางข้อผิดพลาดมาตรฐานไปยังไฟล์ (echo 2) gtgtMyRandomNumbers. txt สะท้อนแม้กระทั่งจำนวนเล็กน้อย (ในกรณีนี้คือ 2) และเปลี่ยนเส้นทางผลลัพธ์ gtgtMyRandomNumbers. txt echo 2 อีกวิธีหนึ่งในการสะท้อนจำนวนที่เล็กและเปลี่ยนเส้นทางการแสดงสตริงที่ไม่มีบรรทัดใหม่ต้องใช้เคล็ดลับ: ตั้งค่า ltNUL pOutput ของคำสั่ง: แสดงผลลัพธ์ของคำสั่ง: ผลลัพธ์ของคำสั่งถัดไปจะเป็น แสดงผลทันทีหลังจาก: ตั้งค่า ltNUL pCurrent time: เวลาแอมป์ t แสดงเวลาปัจจุบัน: ตามด้วยเวลาของ t (ตั้ง ltNUL pCurrent time: amp time t) gttmp. txt เช่นก่อนโดยเปลี่ยนเส้นทางของคำสั่งทั้งสองเป็น a ไฟล์ E NDLOCAL แก้ไขสิ้นสุดชุดตัวแปรสภาพแวดล้อมในท้องถิ่นเริ่มใช้ SETLOCAL สามารถใช้เพื่อสร้างโปรแกรมย่อย: ดูฟังก์ชั่น แก้ไข ERASE ออกจากคอนโซล DOS หรือด้วย b เฉพาะชุดที่ทำงานอยู่หรือที่ดำเนินการในขณะนี้ subroutine ถ้าใช้โดยไม่มีบีในแฟ้มแบทช์ทำให้คอนโซล DOS เรียกใช้แบทช์เพื่อปิด Iterates ผ่านชุดค่าดำเนินการคำสั่ง ในตัวอย่างต่อไปนี้ฉันจะใช้จากบรรทัดคำสั่งในขณะที่ i จะใช้จากแบทช์ สำหรับ i in (1,2,3) do echo i ในชุด, echoes 1, 2 และ 3 ในแบทช์คำสั่งต้องใช้เครื่องหมายเปอร์เซ็นต์คู่ ตัวอย่างที่เหลือมีไว้เพื่อวางโดยตรงลงในบรรทัดคำสั่งดังนั้นพวกเขาจึงใช้เครื่องหมายเปอร์เซ็นต์เดียวและรวมไว้เพื่อป้องกันการแสดงซ้ำ สำหรับ i in (1,2,3) do echo i จากบรรทัดคำสั่ง echoes 1, 2 และ 3 คำสั่ง for จะพยายามตีความไอเท็มเป็นชื่อไฟล์และเป็นรูปแบบของชื่อไฟล์ที่มี wildcards ไม่บ่นหากรายการไม่ตรงกับชื่อไฟล์ที่มีอยู่แม้ว่า สำหรับ i in (1,2, adcet) ทำ echo i ถ้าคุณไม่ได้มีไฟล์ที่ตรงกับรูปแบบที่สามให้ก้อง echo 1 และ 2 ทิ้งรายการที่สาม สำหรับ i in (1 2,34) do echo i Echoes 1, 2, 3 และ 4 ใช่ใช้ส่วนผสมของตัวคั่นรายการ สำหรับ i in (.txt) do echo i เรียกไฟล์ชื่อไฟล์ที่อยู่ในโฟลเดอร์ปัจจุบันและมีนามสกุล. txt สำหรับ i in (C: Windowssystem32.exe) ทำ echo i เรียกชื่อไฟล์ที่ตรงกับรูปแบบ สำหรับ r i in (.txt) ทำ echo i เรียกชื่อไฟล์ด้วยพา ธ เต็มของไฟล์ที่มีนามสกุล. txt อยู่ที่ใดก็ได้ในโฟลเดอร์ปัจจุบันรวมถึงโฟลเดอร์ที่ซ้อนกัน สำหรับ d i in () ทำ echo i เรียกชื่อโฟลเดอร์ทั้งหมดในโฟลเดอร์ปัจจุบัน สำหรับ r d i in () ทำ echo i เรียกชื่อรวมทั้งเส้นทางแบบเต็มของโฟลเดอร์ทั้งหมดในโฟลเดอร์ปัจจุบันรวมถึงโฟลเดอร์ที่ซ้อนกัน สำหรับแต่ละไฟล์ในโฟลเดอร์ปัจจุบันและโฟลเดอร์ย่อยที่มีขนาดใหญ่กว่าหรือเท่ากับ 1,000,000 ไบต์จะแสดงผลขนาดไฟล์เป็นไบต์และเส้นทางแบบเต็มของไฟล์ สำหรับไวยากรณ์ใน zi ดูเปอร์เซ็นต์ทิลเดอร์ สำหรับ l i in (1,1,10) do echo i เรียกตัวเลขจาก 1 ถึง 10 สำหรับ f tokens i in (list. txt) do echo i สำหรับแต่ละบรรทัดในไฟล์จะสะท้อนบรรทัด สำหรับ f tokens i ใน (list1.txt list2.txt) echo i สำหรับแต่ละบรรทัดในไฟล์จะสะท้อนบรรทัด สำหรับ f tokens i in (.txt) ทำ echo i ไม่มีอะไรเลย ไม่ยอมรับสัญลักษณ์ตัวแทนเพื่อให้ตรงกับชื่อไฟล์ สำหรับ f tokens1-3 delims: a in (First: Second :: Third) ทำ echo c-b-a แยกสตริงเป็นโทเค็นที่คั่นด้วย: เครื่องหมายคำพูดระบุว่าสตริงไม่ใช่ชื่อไฟล์ โทเค็นที่สองและสามจะถูกเก็บไว้ใน b และ c ถึงแม้ว่า b และ c จะไม่ได้ระบุไว้อย่างชัดเจนในส่วนของคำสั่งก่อนทำ เครื่องหมายทับสองเส้นต่อเนื่องจะถือว่าเป็นตัวคั่นหนึ่ง c ไม่ใช่ แต่สาม บางส่วนของงานของคำสั่งตัดจากระบบปฏิบัติการอื่น ๆ สำหรับ f tokens1-3 delims: a in (First: Second :: Third: Fourth: Fifth) ทำ echo c-b-a: d ดังที่กล่าวมาแล้วเพียงว่ารายการที่ 4 และ 5 ถูกจับใน d เป็น Fourth: Fifth รวมทั้ง separator สำหรับ f tokens1-3 delims :, a ใน (First, Second,: Third: Fourth: Fifth) ทำ echo c-b-a: d ตัวคั่นหลายตัวเป็นไปได้ สำหรับ f tokens1-3 a ใน (First Second Third, item) ทำ echo c-b-a ตัวคั่นเริ่มต้นคือช่องว่างและแท็บ ดังนั้นจึงแตกต่างจากตัวคั่นที่ใช้ในการแยกอาร์กิวเมนต์ที่ส่งผ่านไปยังแบทช์ สำหรับ f tokens i in (cd) ทำ echo i สำหรับแต่ละบรรทัดของผลลัพธ์ของคำสั่งให้ echoes บรรทัด สำหรับไฟลที่ไมไดอยูในโฟลเดอรปจจุบันจะแสดงแอ็ตทริบิวตของไฟลตามด้วยชื่อไฟล In the string nxai, uses the syntax described at Percent tilde . for f usebackq tokens i in (dir b a-d-h) do echo nxai As above, but using the backquote character () around the command to be executed. for f tokens i in (tasklist sort amp echo End) do echo i Pipes and ampersands in the command to be executed must be escaped using caret (). (for i in (1,2,3) do echo i) gt anyoldtemp. txt To redirect the entire result of a for loop, place the entire loop inside brackets before redirecting. Otherwise, the redirection will tie to the body of the loop, so each new iteration of the body of the loop will override the results of the previous iterations. for i in (1,2,3) do echo i gt anyoldtemp. txt An example related to the one above. It shows the consequence of failing to put the loop inside brackets. Continue: To jump to the next iteration of the loop and thus emulate the continue statement known from many languages, you can use goto provided you put the loop body in a subroutine, as shown in the following: If you use goto directly inside the for loop, the use of goto breaks the loop bookkeeping. The following fails: FTYPE Edit Used for remarks in batch files, preventing the content of the remark from being executed. REM is typically placed at the beginning of a line. If placed behind a command, it does not work, unless preceded by an ampersand, as shown in the example above. An alternative to REM is double colon. RMDIR Edit This is a synonym of RD . Displays or sets environment variables. With P switch, it asks the user for input, storing the result in the variable. With A switch, it performs simple arithmetic calculations, storing the result in the variable. With string assignments, there must be no spaces before and after the equality sign thus, set name Peter does not work, while set namePeter does. set Displays a list of environment variables set HOME Displays the values of the environment variables whose names start with HOME set MYNUMBER56 set HOMEHOMEC:Program FilesMy Bin Folder set P userinputEnter an integer: set A result 4 ( 6 3 ) Sets the result variable with the result of a calculation. See also Calculation . SETLOCAL Edit When used in a batch file, makes all further changes to environment variables local to the current batch file. When used outside of a batch file, does nothing. Can be ended using ENDLOCAL. Exiting a batch file automatically calls end local. Can be used to create subprograms: see Functions . Furthermore, can be used to enable delayed expansion like this: setlocal EnableDelayedExpansion. Delayed expansion consists in the names of variables enclosed in exclamation marks being replaced with their values only after the execution reaches the location of their use rather than at an earlier point. The following is an example of using delayed expansion in a script that prints the specified number of first lines of a file, providing some of the function of the command head known from other operating systems: SHIFT Edit Shifts the batch file arguments along, but does not affect . Thus, if 1Hello 1, 2Hello 2, and 3Hello 3, then, after SHIFT, 1Hello 2, and 2Hello 3, but is Hello 1 Hello 2 Hello 3. START Edit Starts a program in new window, or opens a document. Uses an unclear algorithm to determine whether the first passed argument is a window title or a program to be executed hypothesis: it uses the presence of quotes around the first argument as a hint that it is a window title. start notepad. exe amp echo Done. Starts notepad. exe, proceeding to the next command without waiting for finishing the started one. Keywords: asynchronous. start notepad. exe Launches a new console window with notepad. exe being its title, apparently an undesired outcome. start C:Program FilesInternet Exploreriexplore. exe Starts Internet Explorer. The empty passed as the first argument is the window title of a console that actually does not get opened, or at least not visibly so. start C:Program FilesInternet Exploreriexplore. exe Launches a new console window with C:Program FilesInternet Exploreriexplore. exe being its title, apparently an undesired outcome. start wait notepad. exe amp echo Done. Starts notepad. exe, waiting for it to end before proceeding. start low notepad. exe amp echo Done. As above, but starting the program with a low priority. start MyFile. xls Opens the document in the program assigned to open it. start Starts a new console (command-line window) in the same current folder. start. Opens the current folder in Windows Explorer. start. Opens the parent folder in Windows Explorer. start mailto: Starts the application for writing a new email. start b TODO:example-application-where-this-is-useful Starts the application without opening a new console window, redirecting the output to the console from which the start command was called. Displays or sets the system time. TITLE Edit Sets the title displayed in the console window. External commands available to Windows command interpreter are separate executable program files, supplied with the operating system by Microsoft, or bundled as standard with the third-party command interpreters. By replacing the program files, the meanings and functions of these commands can be changed. Many, but not all, external commands support the convention, causing them to write on-line usage information to their standard output and then to exit with a status code of 0. Displays or changes items in the address resolution protocol cache, which maps IP addresses to physical addresses. Schedules a program to be run at a certain time. See also SCHTASKS . ATTRIB Edit Displays or sets file attributes. With no arguments, it displays the attributes of all files in the current directory. With no attribute modification instructions, it displays the attributes of the files and directories that match the given search wildcard specifications. Similar to chmod of other operating systems. To add an attribute, attach a in front of its letter. To remove an attribute, attach a - in front of its letter Attributes: A - Archived H - Hidden S - System R - Read-only . and possibly others. attrib Displays the attributes of all files in the current directory. attrib File. txt Displays the attributes of the file. attrib r File. txt Adds the Read-only attribute to the file. attrib - a File. txt Removes the Archived attribute from the file. attrib - a r File. txt Removes the Archived attribute and adds the Read-only attribute to the file. attrib r. txt Acts on a set of files. attrib S r. txt Acts recursively in subdirectories. For more, type attrib . BCDEDIT Edit (Not in XP). Edits Boot Configuration Data (BCD) files. For more, type bcdedit . CACLS Edit Shows or changes discretionary access control lists (DACLs). See also ICACLS. For more, type cacls . Displays or sets the active code page number. For more, type chcp . CHKDSK Edit Checks disks for disk problems, listing them and repairing them if wished. For more, type chkdsk . CHKNTFS Edit Shows or sets whether system checking should be run when the computer is started. The system checking is done using Autochk. exe. The NTFS part of the command name is misleading, since the command works not only with NTFS file system but also with FAT and FAT32 file systems. For more, type chkntfs . CHOICE Edit Lets the user choose one of multiple options by pressing a single key, and sets the error level as per the chosen option. Absent in Windows 2000 and Windows XP, it was reintroduced in Windows Vista, and has remained in Windows 7 and 8. choice m Do you agree Presents the user with a yesno question, setting the error level to 1 for yes and to 2 for no. If the user presses Control C, the error level is 0. choice c rgb m Which color do you prefer Presents the user with a question, and indicates the letters for the user. Responds to user pressing r, g or b, setting the error level to 1, 2 or 3. An alternative is set p see SET . CIPHER Edit Shows the encryption state, encrypts or decrypts folders on a NTFS volume. (Not in XP) Places the piped input to the clipboard. set clip Places the listing of environment variables to the clipboard. clip lt File1.txt Places the content of File1.txt to the clipboard. Invokes another instance of Microsofts CMD. Compares files, displaying the differences in their content in a peculiar way. fc File1.txt File2.txt gtNUL ampamp Echo Same echo Different or error Detects difference using the error level of fc. The error level of zero means the files are the same non-zero can mean the files differ but also that one of the files does not exist. Searches for a string in files or input, outputting matching lines. Unlike FINDSTR. it cannot search folders recursively, cannot search for a regular expression, requires quotation marks around the sought string, and treats space literally rather than as a logical or. find (object. txt dir S B find receipt dir S B find I V receipt Prints all non-matching lines in the output of the dir command, ignoring letter case. find C inlined. h Instead of outputting the matching lines, outputs their count. If more than one file is searched, outputs one count number per file preceded with a series of dashes followed by the file name does not output the total number of matching lines in all files. find C V lt file. txt Outputs the number of lines AKA line count in file. txt. Does the job of wc - l of other operating systems. Works by treating as a string not found on the lines. The use of redirection prevents the file name from being output before the number of lines. type file. txt find C V Like the above, with a different syntax. type. txt 2gtNUL find C V Outputs the sum of line counts of the files ending in. txt in the current folder. The 2gtNUL is a redirection of standard error that removes the names of files followed by empty lines from the output. find Schnheit. txt If run from a batch file saved in unicode UTF-8 encoding, searches for the search term Schnheit in UTF-8 encoded. txt files. For this to work, the batch file must not contain the byte order mark written by Notepad when saving in UTF-8. Notepad is an example of a program that lets you write UTF-8 encoded plain text files without byte order mark. While this works with find command, it does not work with FINDSTR . find Copyright C:Windowssystem32a. exe Works with binary files no less than text files. FINDSTR Edit Searches for regular expressions or text strings in files. Does some of the job of grep command known from other operating systems, but is much more limited in the regular expressions it supports. Treats space in a regular expression as a disjunction AKA logical or unless prevented with c option. findstr s 0-90-9.0-90-9.h. cpp Searches recursively all files whose name ends with dot h or dot cpp, printing only lines that contain two consecutive decimal digits followed by anything followed by two consecutive decimal digits. findstr a. b a. c File. txt Outputs all lines in File. txt that match any of the two regular expressions separated by the space. Thus, the effect is one of logical or on regular expressions. echo world findstr hello wo. ld Does not match. Since the 1st item before the space does not look like a regex, findstr treats the whole search term as a plain search term. echo world findstr r hello wo. ld Matches. The use of r forces regex treatment. findstr r c:ID: 0-9 File. txt Outputs all lines in File. txt that match the single regular expression containing a space. The use of c prevents the space from being treated as a logical or. The use of r switches the regular expression treatment on, which was disabled by default by the use of c. To test this, try the following: echo ID: 12findstr r c:ID: 0-9 Matches. echo ID: 12findstr c:ID: 0-9 Does not match, as the search string is not interpreted as a regular expression. echo ID: abcfindstr ID: 0-9 Matches despite the output of echo failing to match the complete regular expression: the search is interpreted as one for lines matching ID: or 0-9. findstr ric:id: 0-9 File. txt Does the same as the previous example, but in a case-insensitive manner. While findstr enables this sort of accumulation of switches behind a single , this is not possible with any command. For instance, dir bs does not work, while dir b s does. To test this, try the following: echo ID: 12findstr ric:id: 0-9 echo ID: abfindstr ric:id: 0-9 findstr msric:id: 0-9.txt Like above, but recursively for all files per s, displaying only matching files rather than matching lines per m. echo hel lo findstr c:hel lo c:world c switch can be used multiple times to create logical or. echo hello findstr hello Does not match. Backslash before quotation marks and multiple other characters acts as an escape thus, matches . echo hello findstr hello Matches. Double backslash passed to findstr stands for a single backslash. echo hello findstr hello Matches. None of the single backslashes passed to findstr is followed by a character on which the backslash acts as an escape. echo hey findstr hey more To search for a quote (quotation mark), you need to escape it two times: once for the shell using caret (), and once for findstr using backslash (). echo hey findstr hey there more To search for a quote and have the search term enclosed in quotes as well, the enclosing quotes need to be escaped for the shell using caret (). echo comment line findstr If forward slash () is the 1st character in the search term, it needs to be escaped with a backslash (). The escaping is needed even if the search term is enclosed in quotes. findstr f:FileList. txt def.(): Search in the files stated in FileList. txt, one file per line. File names in FileList. txt can contain spaces and do not need to be surrounded with quotation marks for this to work. findstr g:SearchTermsFile. txt. txt Search for the search terms found in SearchTermsFile. txt, one search term per line. A space does not serve to separate two search terms rather, each line is a complete search term. A line is matched if at least one of the search terms matches. If the first search term looks like a regex, the search will be a regex one, but if it looks like a plain search term, the whole search will be a plain one even if 2nd or later search terms look like regex. findstr xlg:File1.txt File2.txt Outputs set intersection: lines present in both files. findstr xlvg:File2.txt File1.txt Outputs set difference: File1.txt - File2.txt. findstr m Microsoft C:Windowssystem32 Works with binary files no less than text files. Limitations of the regular expressions of findstr, as compared to grep: No support of groups -- (, ). No support of greedy iterators -- . No support of zero or one of the previous -- . And more. echo bbfindstr bb baaaa Does not find anything in multiple Windows versions, but it should. Also consider typing findstr . FORFILES Edit Finds files by their modification date and file name pattern, and executes a command for each found file. Is very limited, especially compared to the find command of other operating systems. Available since Windows Vista. For more, type forfiles . forfiles s d 06102015 c cmd c echo fdate path For each file in the current folder and its subfolders modified on 10 June 2015 or later, outputs the file modification date and full file path. The date format after d is locale specific. Thus, allows to find most recently modified files. Keywords: most recently changed files. forfiles m. txt s d 06102015 c cmd c echo fdate path As above, but only for files ending in. txt. FORMAT Edit Formats a disk to use Windows-supported file system such as FAT, FAT32 or NTFS, thereby overwriting the previous content of the disk. To be used with great caution. FSUTIL Edit A powerful tool performing actions related to FAT and NTFS file systems, to be ideally only used by powerusers with an extensive knowledge of the operating systems. GPRESULT Edit Displays group policy settings and more for a user or a computer. GRAFTABL Edit Enables the display of an extended character set in graphics mode. Fore more, type graftabl . Shows command help. help Shows the list of Windows-supplied commands. help copy Shows the help for COPY command, also available by typing copy . ICACLS Edit (Not in XP) Shows or changes discretionary access control lists (DACLs) of files or folders. See also CACLS. Fore more, type icacls . IPCONFIG Edit Displays Windows IP Configuration. Shows configuration by connection and the name of that connection (i. e. Ethernet adapter Local Area Connection) Below that the specific info pertaining to that connection is displayed such as DNS suffix and ip address and subnet mask. LABEL Edit Adds, sets or removes a disk label. MAKECAB Edit Places files into compressed. cab cabinet file. See also EXPAND . A multi-purpose command to display device status, configure ports and devices, and more. mode Outputs status and configuration of all devices, such as com3 and con. mode con Outputs status and configuration of con device, the console in which the command interpreter is running. mode con cols120 lines20 Sets the number of columns and lines for the current console, resulting in window resizing, and clears the screen. The setting does not affect new console instances. Keywords: wide screen, wide window, screen size, window size, resize screen, resize window. mode 120, 20 As above: Sets the number of columns (120) and lines (20), resulting in window resizing, and clears the screen. mode con cols120 Sets the number of columns for the current console, resulting in window resizing, and clears the screen. It seems to change the number of visible lines as well, but the total lines count of the console buffer seems unchanged. mode 120 As above: Sets the number of columns. mode con cp Outputs the current code page of the console. mode con cp select850 Sets the current code page of the console. For a list of code pages, see the linked Microsoft documentation below. mode con rate31 delay1 Sets the rate and delay for repeated entry of a character while a key is held pressed, of the console. The lower the rate, the fewer repetitions per second. Displays the contents of a file or files, one screen at a time. When redirected to a file, performs some conversions, also depending on the used switches. more Test. txt more. txt grep - i sought. string Source. txt more p gtOut. txt Taking the output of a non-Windows grep command that produces line breaks consisting solely of LF character without CR character, converts LF line breaks to CR-LF line breaks. CR-LF newlines are also known as DOS line breaks, Windows line breaks, DOS newlines, Windows newlines, and CRLF line endings, as opposed to LF line breaks used by some other operating systems. In some setups, seems to output gibberish if the input contains LF line breaks and tab characters at the same time. In some setups, for the conversion, p may be unneeded. Thus, more would convert the line breaks even without p. more t4 Source. txt gtTarget. txt Converts tab characters to 4 spaces. In some setups, tab conversion takes place automatically, even without the t switch. If so, it is per default to 8 spaces. The online documentation for more in Windows XP and Windows Vista does not mention the switch. The switch e is mentioned in more at least in Windows XP and Windows Vista. Per more , the switch is supposed to enable extended features listed at the end of more help such as showing the current row on pressing . However, in Windows XP and Windows Vista, that seems to be enabled by default even without e. Hypothesis: In Windows XP and Windows Vista, e does not do anything it is present for compatibility reasons. Provides various network services, depending on the command used. Available variants per command: net accounts net computer net config net continue net file net group net help net helpmsg net localgroup net name net pause net print net send net session net share net start net statistics net stop net time net use net user net view OPENFILES Edit Performs actions pertaining to open files, especially those opened by other users over the network. The actions involve querying, displaying, and disconnecting. For more, type openfiles . Send ICMPIP echo packets over the network to the designated address (or the first IP address that the designated hostname maps to via name lookup) and print all responses received. RECOVER Edit Recovers as much information as it can from damaged files on a defective disk. Queries or modifies Windows registry. The first argument is one of the following commands: query, add, delete, copy, save, load, unload, restore, compare, export, import, and flags. To learn more about a command, follow it by . like reg query . REPLACE Edit Replaces files in the destination folder with same-named files in the source folder. ROBOCOPY Edit (Not in XP) Copies files and folders. See also XCOPY and COPY . RUNDLL32 Edit Runs a function available from a DLL. The available DLLs and their functions differ among Windows versions. rundll32 sysdm. cpl, EditEnvironmentVariables In some Windows versions, opens the dialog for editing environment variables. SCHTASKS Edit Schedules a program to be run at a certain time, more powerful than AT . Like SET. but affecting the whole machine rather than the current console or process. Not available in Windows XP available in Windows Vista and later. SHUTDOWN Edit Shuts down a computer, or logs off the current user. Sorts alphabetically, from A to Z or Z to A. Cannot sort numerically: if the input contains one integer per line, 12 comes before 9. sort File. txt Outputs the sorted content of File. txt. sort r File. txt Sorts in reverse order, Z to A. dir b sort SUBST Edit Assigns a drive letter to a local folder, displays current assignments, or removes an assignment. subst p. Assigns p: to the current folder. subst Shows all assignments previously made using subst. subst d p: Removes p: assignment. SYSTEMINFO Edit Shows configuration of a computer and its operating system. TASKKILL Edit Ends one or more tasks. taskkill im AcroRd32.exe Ends all process with the name AcroRd32.exe thus, ends all open instances of Acrobat Reader. The name can be found using tasklist . taskkill f im AcroRd32.exe As above, but forced . Succeeds in ending some processes that do not get ended without f. tasklist find notepadtaskkill PID 5792 Ends the process AKA task with process ID (PID) of 5792 the assumption is you have found the PID using tasklist. TASKLIST Edit Lists tasks, including task name and process id (PID). tasklist sort tasklist find AcroRd tasklist find C chrome. exe Displays the number of tasks named chrome. exe, belonging to Google Chrome browser. TIMEOUT Edit Waits a specified number of seconds, displaying the number of remaining seconds as time passes, allowing the user to interrupt the waiting by pressing a key. Also known as delay or sleep. Available in Windows Vista and later. timeout t 5 Waits for five seconds, allowing the user to cancel the waiting by pressing a key. timeout t 5 nobreak Waits for five seconds, ignoring user input other than Control C. timeout t 5 nobreak gtnul As above, but with no output. Workaround in Windows XP: ping - n 6 127.0.0.1 gtnul Waits for five seconds the number after - n is the number of seconds to wait plus 1. Perl-based workaround in Windows XP, requiring Perl installed: Displays a tree of all subdirectories of the current directory to any level of recursion or depth. If used with F switch, displays not only subdirectories but also files. tree tree f Includes files in the listing, in addition to directories. tree f a As above, but uses 7-bit ASCII characters including , - and to draw the tree. A snippet of a tree using 8-bit ASCII characters: A snippet of a tree using 7-bit ASCII characters: WHERE Edit Outputs one or more locations of a file or a file name pattern, where the file or pattern does not need to state the extension if it listed in PATHEXT. such as. exe. Searches in the current directory and in the PATH by default. Does some of the job of which command of some other operating systems, but is more flexible. Available on Windows 2003, Windows Vista, Windows 7, and later not available on Windows XP. An alternative to be used with Windows XP is in the examples below. Does not find internal commands, as there are no dot exe files for them to match. where find Outputs the location of the find command, possibly C:WindowsSystem32find. exe. The. exe extension does not need to be specified as long as it is listed in PATHEXT. which it is by default. If there are more find commands in the path, outputs paths to both. In some situations, it can output the following: C:WindowsSystem32find. exe C:Program FilesGnuWin32binfind. exe PATH:i Outputs the location of find. exe on Windows XP. The name has to include. exe, unlike with the where command. where r. Tasks Searches for files whose name matches Task recursively from the current folder. Similar to dir b s Tasks. The r switch disables search in the folders in PATH. where. bat Outputs all. bat files in the current directory and in the directories that are in PATH. Thus, outputs all. bat files that you can run without entering their full path. where ls. bat As above, constraining also the beginning of the name of the. bat files. where ls As above, but with no constraint on the extension. Finds lsdisks. bat, lsmice. pl, and lsmnts. py if in the current directory or in the path. where. exe more Displays countless. exe and files in the path and in the current folder, including those in C:WindowsSystem32. where path:.bat Outputs. bat files in the path but not those in the current folder unless the current folder is in PATH. Instead of path, another environment variable containing a list of directories can be used. where windir:.exe Outputs. exe files found in the folder stated in WINDIR environment variable. where path:.bat windir:.exe A combination is possible. Outputs all files matching either of the two queries. where q. bat ampamp echo Found Suppresses both standard and error output, but sets the error level, enabling testing on it. The error level is set either way, with or without q. Starts Windows Management Instrumentation Command-line (WMIC), or with arguments given, passes the arguments as commands to WMIC. Not in Windows XP Home. For more, type wmic . wmic logicaldisk get caption, description Lists drives (disks) accessible under a drive letter, whether local hard drives, CD-ROM drives, removable flash drives, network drives or drives created using SUBST . wmic Control C Enters wmic and then interrupts it. A side effect is that the console buffer becomes very wide, and the screen becomes horizontally resizable with the mouse as a consequence. This is the result of wmic setting a high number of columns of the console, which you can verify using mode con . You can achieve a similar result by typing mode 1500 . See also MODE . XCOPY Edit Copies files and directories in a more advanced way than COPY. deprecated in Windows Vista and later. Type xcopy to learn more, including countless options. xcopy C:Windowssystem Copies all files, but not files in nested folders, from the source folder (C:Windowssystem) to the current folder. xcopy s i C:Windowssystem C:Windows-2system Copies all files and folders to any nesting depth (via s) from the source folder (C:Windowssystem) to C:Windows-2system, creating Windows-2system if it does not exist (via i). xcopy s i d:09-01-2014 C:Windowssystem C:Windows-2system As above, but copies only files changed on 1 September 2014 or later. Notice the use of the month-first convention even if you are on a non-US locale of Windows. xcopy L s i d:09-01-2014 C:Windowssystem C:Windows-2system As above, but in a test mode via L (list-only, output-only, display-only). Thus, does not do any actual copying, merely lists what would be copied. Windows XP - Command-line reference A-Z at microsoft Windows CMD Commands at ss64 -- licensed under Creative Commons Attribution-Non-Commercial-Share Alike 2.0 UK: England amp Wales1. and thus incompatible with CC-BY-SA used by Wikibooks The FreeDOS HTML Help at fdos. org -- a hypertext help system for FreeDOS commands, written in 20032004, available under the GNU Free Documentation License

Comments

Popular posts from this blog

Binary ตัวเลือก การค้า สิงคโปร์

Binary ตัวเลือก No สูญเสีย Acord

15 นาที กลยุทธ์ อัตราแลกเปลี่ยน ซื้อขาย