1 / 9

โครงสร้างคอมพิวเตอร์ และภาษาแอสเซมบลี้

โครงสร้างคอมพิวเตอร์ และภาษาแอสเซมบลี้. Introduction to Batch File. ผศ.บุรินทร์ รุจจนพันธุ์ . ปรับปรุง 1 9 ตุลาคม 2555. มหาวิทยาลัยเนชั่น จังหวัดลำปาง http://www. nation.ac.th. ความหมาย.

Télécharger la présentation

โครงสร้างคอมพิวเตอร์ และภาษาแอสเซมบลี้

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. โครงสร้างคอมพิวเตอร์ และภาษาแอสเซมบลี้ Introduction to Batch File ผศ.บุรินทร์ รุจจนพันธุ์ . ปรับปรุง 19 ตุลาคม 2555 มหาวิทยาลัยเนชั่น จังหวัดลำปาง http://www.nation.ac.th

  2. ความหมาย BAT file (BATch file) A file of DOS or OS/2 commands, which are executed one after the other. It has a .BAT extension and is created with a text editor. A file of DOS commands that are "batch" processed one after the other. Windows also supports batch files, which are mostly identical to the DOS commands. To create a DOS batch file, use a text editor such as Edit. If you use a word processor, save your batch file as an ASCII text file, not as a standard document. Always include a .BAT extension with your batch file name. ข้อมูลจาก http://www.techweb.com/encyclopedia/defineterm.jhtml?term=DOSbatchfile

  3. ตัวอย่างรวมในแฟ้มเดียว เช่น boy1.bat @echo off cd \ md abc cd abc md aa md bb cd aa echo a > a1 echo b > a2 dir > a3 dir > a4 copy * ..\bb cd \ dir abc /s/w

  4. ใช้ Batch File สร้าง แปล ประมวลผล Java @echo off echo help to write Java program and compile and execute echo wait for result echo ================================================== cd c:\j2sdk1.4.2_03\bin\ echo class boy2{ > boy2.java echo public static void main(String args[]){>> boy2.java echo System.out.println("oho batch file");}}>> boy2.java javac boy2.java java boy2

  5. ใช้ตัวแปรที่เคย Set ไว้ คำสั่ง set เพื่อแสดงชื่อตัวแปร และค่า คำสั่ง set a=5เพิ่มตัวแปรใน set @echo off echo %PROMPT% echo %OS% echo %a%

  6. ส่งค่าผ่าน Command Line DOS>a.bat b c DOS>a b c Output echo %0 => a echo %1 => b echo %2 => c echo %3 => ECHO is on

  7. เลื่อนค่าที่ส่งผ่าน Command Line DOS>a.bat b c DOS>a b c Output echo %1 => b shift echo %1 => c shift echo %1 => ECHO is on

  8. เลือกกระทำตาม Label • DOS>menu.bat 1 • output => one • menu.bat • @echo off • if .%1 == .1 goto one • if .%1 == .2 goto two • goto end • :one • echo one • goto end • :two • echo two • :end

  9. ทำซ้ำตามค่าที่รับเข้ามาทำซ้ำตามค่าที่รับเข้ามา • DOS>loop.bat 5 9 12 • output => 5 9 12 • loop.bat • @echo off • for %%x in (%1 %2 %3 %4) do echo %%x

More Related