SlideShare a Scribd company logo
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Bekerja dengan Antarmuka
Baris Perintah
Pertemuan 12
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Overview
• Dalam bab ini, Anda akan belajar untuk
– Menjelaskan pengoperasian antarmuka baris
perintah
– Jalankan perintah dasar dari baris
perintah
– Memanipulasi file dan folder dari baris
perintah
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Historical/Conceptual
• IBM menemukan PC pada akhir 70-an tetapi
membutuhkan sistem operasiDigital Research had
an OS but turned them down
– IBM pergi ke sebuah perusahaan kecil (Bill Gates di Microsoft)
yang telah menciptakan BASIC
– Microsoft tidak pernah menulis OS tetapi
menerima tantangan itu
– Gates menemukan OS bernama Quick-and-
Dirty-Operating-System (QDOS) dan
membelinya dari orang yang menulisnya
– Microsoft merilisnya sebagai MS-DOS V 1.1
(Microsoft Disk Operating System)
– MS-DOS 6.22 akhirnya dirilis pada tahun 1994
– DOS menggunakan antarmuka baris perintah
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Menguraikan Antarmuka Baris
Perintah
IT Technician
CompTIA A+
Technician
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Command-Line Interface (CLI)
• Bagaimana cara kerja antarmuka baris
perintah?Begins with a prompt
indicating the computer is ready to do
something
– Ketik perintah dan tekan ENTER
– Perintah dijalankan
– Perintah baru ditampilkan—siap untuk perintah berikutnya
– CLI mengeksekusi perintah seperti Windows GUI
– Di CLI, ketik perintah dan tekan ENTER
– Di GUI, arahkan dan klik untuk menjalankan perintah
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Accessing the Command Line
• In Windows 2000 use the Run dialog box
– Start | Run
– Type cmd
• You may also access the command line
through the Start | All Programs menu
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
The Command Prompt
• Command prompt selalu difokuskan pada
folder tertentu
– Setiap perintah beroperasi pada file dan folder di
folder tempat Anda fokus
– Anda harus terlebih dahulu fokus pada
drive dan folder tempat Anda ingin
bekerja
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Filenames and File Formats
• Setiap program atau potongan data
disimpan sebagai file di drive
• Dalam DOS, panjangnya hingga 8 karakter
– Disebut sistem penamaan 8.3
– Karakter ini tidak boleh digunakan
/  [ ] | ÷ + = ; , * ?
•Ekstensi
•Dalam DOS, hingga 3 karakter
•FakultatifThe filename and
extension are separated by a dot
• Nama file memiliki dua bagianFilename
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Filenames and Formats
• Windows tidak membatasi nama file
untuk 8.3 (bisa sampai 255 karakter)
• Agar kompatibel dengan DOS, Anda
harus mengikuti standar 8.3
• Windows membuat dua nama file untuk
setiap file untuk memastikan
kompatibilitas mundur
• Ekstensi memberi tahu komputer jenis
file.exe, .doc, .xls
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
File Formats
• Semua file ditulis dalam format biner
• American Standard Code for Information
Interchange (ASCII) digunakan untuk
teks
• Universal file format
– Mendefinisikan 256 karakter 8-bit
• Unicode
– Menggunakan kode 16-bit untuk mencakup setiap
karakter untuk bahasa yang paling umum
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
ASCII Character Chart
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Drives and Folders
• At boot, Windows assigns partitions and
a drive letter
– Floppy drives are usually assigned A: or B:
– Hard drive partitions may be assigned C: to Z:
– CD-ROM drives are named after hard drives
• Windows uses a hierarchical directory
tree
– Files are put into groups called folders
• In DOS we call folders directories
– The root directory is at the beginning of the
hierarchical structure with folders underneath
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Folders and Files
• Folders and files must be unique
– Can’t be the same name in the same folder
• C: represents the root directory of C
• To describe a subfolder, add the name of
the folder
– C:TEST
• The location of a file is called the path
– The path of C:testfile.txt is C:test
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Directory Tree
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Mastering Fundamental Commands
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Structure: Syntax and Switches
• The command line requires the exact
syntax for each command
• Type the name of the command and
desired or allowed switches
– Switches modify the behavior of the command
– Multiple switches may be allowable
– DIR /W /P
Displays the directory in wide mode and one page
at a time
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Help
• Help with any command is readily
available in one of three ways
– HELP gives a one-line description of each
command
– HELP command gives specific help for the
command
– Command /? gives specific help for the command
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
DIR Command
• The DIR command lists the contents of a
particular directory
– The DIR/W command lists only the filenames
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
DIR Command Switches
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Directories: CD Command
• The CD (or CHDIR) command is used to
change the focus to a different directory
• The CD command is used to return to
the root directory
• CD .. Goes up one directory
• To switch between drives, type the drive
letter followed by a colon
– C:
– D:
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Making and Removing Directories
• The MD (or MKDIR) command is used for
creating a directory
• The DEL command is used for deleting
files, and the RD (RMDIR) command is
used for deleting directories and
subdirectories
• The DELTREE command is used for
deleting directories containing files and
subdirectories
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Running a Program
To run a program:
– Change the DOS focus to the directory where the
program is stored
CD C:Program FilesMy Program
– Type the filename with or without its extension and
press ENTER
Setup.exe
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Working with Files
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Working with Files
• Attributes (H, R, S, A) are special values
assigned to a file
– Hidden: hides the file
– Read-only: protects a file
from being deleted or modified
– System: identifies system files
– Archive: identifies files that
have not been backed up
• The ATTRIB.EXE program is used to
inspect and change file attributes
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Attrib
• Attrib can be used to change the
attributes
– Use + to add attribute
- Use – to remove attribute
Attrib +R AILOG.TXT Makes it read only
Attrib –H AILOG.TXT Makes it no longer hidden
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Working with Files
Wildcards:
– Wildcards are special characters that enable
commands to act on more than one file at a time
– The * represents any number of characters
– The ? represents a single character
DIR *.TXT Lists all files that end in .TXT
DIR *.?XT Lists all files that end in XT
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Working with Files
• REN command is used to rename files
• DEL and ERASE commands are used to
delete files
• COPY command is used for making a
copy of the file in a new location
• MOVE command is used for moving the
file to a new location
• XCOPY command is used for working
with multiple directories
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Mike’s Five-Step COPY/MOVE
Process
1. Point the command prompt to the
directory containing the files to be
copied or moved
C:> CD DOCS
2. Type COPY or MOVE and a space
C:DOCS> COPY
3. Type the name(s) of the file(s) to be
copied/moved and a space
C:DOCS> COPY *.doc
4. Type the path of the new location for
the files
C:DOCS> COPY *.doc c:Steam
5. Press ENTER
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Working with Batch Files
• Batch files are text files that store a
series of commands
– One command on each line
– Batch files use the .BAT extension
– Batch files may be edited with any text editor
• Notepad
• EDIT
– Batch files get their own type of icon
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
EDIT
• EDIT is a command-line command that
starts a basic text editor
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Creating a Batch File
• Using EDIT, type in some commands on
their own line (such as cd: and Dir)
• Save the file with a .BAT extension
– C:test.bat
• Launch a command prompt and run the
batch file
C:> CD 
C:> Test.bat
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Additional Commands
• Some additional commands are
– VER shows the current version of Windows
– ECHO tells the batch file to put text on the screen
– TYPE displays the contents of a batch file on
the screen
– SET display settings that Windows has loaded
by default
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
ECHO Command
• ECHO will display text on the screen
• ECHO OFF turns off the display of text on
the screen
• @ at the beginning of a line prevents
displaying the command, but not the
result of the command
• @ECHO OFF is frequently used in batch
files to “clean up” the appearance when
the batch file is run
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
SET and PATH Commands
• SET will display the list of settings that
Windows loads by default
• Programs (and batch files) are run from
the location where the prompt is
– If the program is not located in the current folder,
you receive an error message
– To tell your command to look in other places, use
the PATH command
• PATH by itself lists the current list of places to look for
a program
• PATH= location; location; location; … will add locations
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Beyond A+
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
Using Special Keys
• F1 function key brings back the previous
command one letter at a time
• F3 function key brings back the entire
command at once
• The DOSKEY command stores a list of all
previously typed commands and can be
accessed by using the up arrow key
– Type DOSKEY
– Windows XP/2000 automatically starts the program
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
COMPACT Command
• COMPACT
– Displays or alters the compression state of files
– compact /c
© 2007 The McGraw-Hill Companies, Inc. All rights reserved
CIPHER Command
• CIPHER
– Displays or alters the encryption state of files
– /e specifies encryption operation
– /a says to apply it to the files as well as the
directory

More Related Content

PPT
Linux komputer coding line command infor
PPTX
DOS - Disk Operating System
DOC
PC Software - Computer Application - Office Automation Tools
PPTX
Ms DOS
PDF
Command
PPT
basicmsdos.ppt
PPT
basic ms dos commands and theory in OSystem
PPT
basicmsdos.ppt
Linux komputer coding line command infor
DOS - Disk Operating System
PC Software - Computer Application - Office Automation Tools
Ms DOS
Command
basicmsdos.ppt
basic ms dos commands and theory in OSystem
basicmsdos.ppt

Similar to Windows command line function try at home (20)

PPTX
MS Dos command
PPTX
OSOA Unit-1 Introduction to DOS and Windows.pptx
PPT
Introduction to ms dos
PDF
Ms dos full explanation
PPTX
DOS PRESENTATION FROM INFORMATION AND TECNOLOGY PACKAGES SPECIALLY FOR COMPUT...
PDF
Msdos crash course
PPT
disk-operating-system.ppt c sdsommands cd
PDF
What is DOS (Disk Operating System).pdf
PDF
lab2.pptx.pdf
PPTX
2. UNIX OS System Architecture easy.pptx
PPTX
linux chapter 5.pptx lesson About introduction to linux
PDF
CMD Command prompts
PPT
p_ms-dos-new.ppt
PPT
Dos_Commands.ppt
PPTX
10 MS DOS and Its Commands.pptx .related to
PPT
PPTX
DOS commands
MS Dos command
OSOA Unit-1 Introduction to DOS and Windows.pptx
Introduction to ms dos
Ms dos full explanation
DOS PRESENTATION FROM INFORMATION AND TECNOLOGY PACKAGES SPECIALLY FOR COMPUT...
Msdos crash course
disk-operating-system.ppt c sdsommands cd
What is DOS (Disk Operating System).pdf
lab2.pptx.pdf
2. UNIX OS System Architecture easy.pptx
linux chapter 5.pptx lesson About introduction to linux
CMD Command prompts
p_ms-dos-new.ppt
Dos_Commands.ppt
10 MS DOS and Its Commands.pptx .related to
DOS commands
Ad

Recently uploaded (20)

PDF
Ornithology-Basic-Concepts.pdf..........
PDF
Urban Hub 50: Spirits of Place - & the Souls' of Places
PPTX
Concept of Safe and Wholesome Water.pptx
PDF
2-Reqerwsrhfdfsfgtdrttddjdiuiversion 2.pdf
PDF
Insitu conservation seminar , national park ,enthobotanical significance
PPTX
Biodiversity.udfnfndrijfreniufrnsiufnriufrenfuiernfuire
PPTX
Office Hours on Drivers of Tree Cover Loss
DOCX
D-360 ESG Series: Sustainable Hospitality Strategies for a Greener Future
PPTX
Green Modern Sustainable Living Nature Presentation_20250226_230231_0000.pptx
PDF
Effects of rice-husk biochar and aluminum sulfate application on rice grain q...
DOCX
Epoxy Coated Steel Bolted Tanks for Dairy Farm Water Ensures Clean Water for ...
PDF
Bai bao Minh chứng sk2-DBTrong-003757.pdf
PDF
Blue Economy Development Framework for Indonesias Economic Transformation.pdf
PPTX
Plant_Cell_Presentation.pptx.com learning purpose
PPTX
Conformity-and-Deviance module 7 ucsp grade 12
DOCX
Epoxy Coated Steel Bolted Tanks for Crude Oil Large-Scale Raw Oil Containment...
PPTX
NOISE-MITIGATION.-pptxnaksnsbaksjvdksbsksk
PPTX
Disposal Of Wastes.pptx according to community medicine
DOCX
Epoxy Coated Steel Bolted Tanks for Farm Digesters Supports On-Farm Organic W...
PPTX
Biodiversity of nature in environmental studies.pptx
Ornithology-Basic-Concepts.pdf..........
Urban Hub 50: Spirits of Place - & the Souls' of Places
Concept of Safe and Wholesome Water.pptx
2-Reqerwsrhfdfsfgtdrttddjdiuiversion 2.pdf
Insitu conservation seminar , national park ,enthobotanical significance
Biodiversity.udfnfndrijfreniufrnsiufnriufrenfuiernfuire
Office Hours on Drivers of Tree Cover Loss
D-360 ESG Series: Sustainable Hospitality Strategies for a Greener Future
Green Modern Sustainable Living Nature Presentation_20250226_230231_0000.pptx
Effects of rice-husk biochar and aluminum sulfate application on rice grain q...
Epoxy Coated Steel Bolted Tanks for Dairy Farm Water Ensures Clean Water for ...
Bai bao Minh chứng sk2-DBTrong-003757.pdf
Blue Economy Development Framework for Indonesias Economic Transformation.pdf
Plant_Cell_Presentation.pptx.com learning purpose
Conformity-and-Deviance module 7 ucsp grade 12
Epoxy Coated Steel Bolted Tanks for Crude Oil Large-Scale Raw Oil Containment...
NOISE-MITIGATION.-pptxnaksnsbaksjvdksbsksk
Disposal Of Wastes.pptx according to community medicine
Epoxy Coated Steel Bolted Tanks for Farm Digesters Supports On-Farm Organic W...
Biodiversity of nature in environmental studies.pptx
Ad

Windows command line function try at home

  • 1. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Bekerja dengan Antarmuka Baris Perintah Pertemuan 12
  • 2. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Overview • Dalam bab ini, Anda akan belajar untuk – Menjelaskan pengoperasian antarmuka baris perintah – Jalankan perintah dasar dari baris perintah – Memanipulasi file dan folder dari baris perintah
  • 3. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Historical/Conceptual • IBM menemukan PC pada akhir 70-an tetapi membutuhkan sistem operasiDigital Research had an OS but turned them down – IBM pergi ke sebuah perusahaan kecil (Bill Gates di Microsoft) yang telah menciptakan BASIC – Microsoft tidak pernah menulis OS tetapi menerima tantangan itu – Gates menemukan OS bernama Quick-and- Dirty-Operating-System (QDOS) dan membelinya dari orang yang menulisnya – Microsoft merilisnya sebagai MS-DOS V 1.1 (Microsoft Disk Operating System) – MS-DOS 6.22 akhirnya dirilis pada tahun 1994 – DOS menggunakan antarmuka baris perintah
  • 4. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Menguraikan Antarmuka Baris Perintah IT Technician CompTIA A+ Technician
  • 5. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Command-Line Interface (CLI) • Bagaimana cara kerja antarmuka baris perintah?Begins with a prompt indicating the computer is ready to do something – Ketik perintah dan tekan ENTER – Perintah dijalankan – Perintah baru ditampilkan—siap untuk perintah berikutnya – CLI mengeksekusi perintah seperti Windows GUI – Di CLI, ketik perintah dan tekan ENTER – Di GUI, arahkan dan klik untuk menjalankan perintah
  • 6. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Accessing the Command Line • In Windows 2000 use the Run dialog box – Start | Run – Type cmd • You may also access the command line through the Start | All Programs menu
  • 7. © 2007 The McGraw-Hill Companies, Inc. All rights reserved The Command Prompt • Command prompt selalu difokuskan pada folder tertentu – Setiap perintah beroperasi pada file dan folder di folder tempat Anda fokus – Anda harus terlebih dahulu fokus pada drive dan folder tempat Anda ingin bekerja
  • 8. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Filenames and File Formats • Setiap program atau potongan data disimpan sebagai file di drive • Dalam DOS, panjangnya hingga 8 karakter – Disebut sistem penamaan 8.3 – Karakter ini tidak boleh digunakan / [ ] | ÷ + = ; , * ? •Ekstensi •Dalam DOS, hingga 3 karakter •FakultatifThe filename and extension are separated by a dot • Nama file memiliki dua bagianFilename
  • 9. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Filenames and Formats • Windows tidak membatasi nama file untuk 8.3 (bisa sampai 255 karakter) • Agar kompatibel dengan DOS, Anda harus mengikuti standar 8.3 • Windows membuat dua nama file untuk setiap file untuk memastikan kompatibilitas mundur • Ekstensi memberi tahu komputer jenis file.exe, .doc, .xls
  • 10. © 2007 The McGraw-Hill Companies, Inc. All rights reserved File Formats • Semua file ditulis dalam format biner • American Standard Code for Information Interchange (ASCII) digunakan untuk teks • Universal file format – Mendefinisikan 256 karakter 8-bit • Unicode – Menggunakan kode 16-bit untuk mencakup setiap karakter untuk bahasa yang paling umum
  • 11. © 2007 The McGraw-Hill Companies, Inc. All rights reserved ASCII Character Chart
  • 12. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Drives and Folders • At boot, Windows assigns partitions and a drive letter – Floppy drives are usually assigned A: or B: – Hard drive partitions may be assigned C: to Z: – CD-ROM drives are named after hard drives • Windows uses a hierarchical directory tree – Files are put into groups called folders • In DOS we call folders directories – The root directory is at the beginning of the hierarchical structure with folders underneath
  • 13. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Folders and Files • Folders and files must be unique – Can’t be the same name in the same folder • C: represents the root directory of C • To describe a subfolder, add the name of the folder – C:TEST • The location of a file is called the path – The path of C:testfile.txt is C:test
  • 14. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Directory Tree
  • 15. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Mastering Fundamental Commands
  • 16. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Structure: Syntax and Switches • The command line requires the exact syntax for each command • Type the name of the command and desired or allowed switches – Switches modify the behavior of the command – Multiple switches may be allowable – DIR /W /P Displays the directory in wide mode and one page at a time
  • 17. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Help • Help with any command is readily available in one of three ways – HELP gives a one-line description of each command – HELP command gives specific help for the command – Command /? gives specific help for the command
  • 18. © 2007 The McGraw-Hill Companies, Inc. All rights reserved DIR Command • The DIR command lists the contents of a particular directory – The DIR/W command lists only the filenames
  • 19. © 2007 The McGraw-Hill Companies, Inc. All rights reserved DIR Command Switches
  • 20. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Directories: CD Command • The CD (or CHDIR) command is used to change the focus to a different directory • The CD command is used to return to the root directory • CD .. Goes up one directory • To switch between drives, type the drive letter followed by a colon – C: – D:
  • 21. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Making and Removing Directories • The MD (or MKDIR) command is used for creating a directory • The DEL command is used for deleting files, and the RD (RMDIR) command is used for deleting directories and subdirectories • The DELTREE command is used for deleting directories containing files and subdirectories
  • 22. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Running a Program To run a program: – Change the DOS focus to the directory where the program is stored CD C:Program FilesMy Program – Type the filename with or without its extension and press ENTER Setup.exe
  • 23. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Working with Files
  • 24. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Working with Files • Attributes (H, R, S, A) are special values assigned to a file – Hidden: hides the file – Read-only: protects a file from being deleted or modified – System: identifies system files – Archive: identifies files that have not been backed up • The ATTRIB.EXE program is used to inspect and change file attributes
  • 25. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Attrib • Attrib can be used to change the attributes – Use + to add attribute - Use – to remove attribute Attrib +R AILOG.TXT Makes it read only Attrib –H AILOG.TXT Makes it no longer hidden
  • 26. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Working with Files Wildcards: – Wildcards are special characters that enable commands to act on more than one file at a time – The * represents any number of characters – The ? represents a single character DIR *.TXT Lists all files that end in .TXT DIR *.?XT Lists all files that end in XT
  • 27. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Working with Files • REN command is used to rename files • DEL and ERASE commands are used to delete files • COPY command is used for making a copy of the file in a new location • MOVE command is used for moving the file to a new location • XCOPY command is used for working with multiple directories
  • 28. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Mike’s Five-Step COPY/MOVE Process 1. Point the command prompt to the directory containing the files to be copied or moved C:> CD DOCS 2. Type COPY or MOVE and a space C:DOCS> COPY 3. Type the name(s) of the file(s) to be copied/moved and a space C:DOCS> COPY *.doc 4. Type the path of the new location for the files C:DOCS> COPY *.doc c:Steam 5. Press ENTER
  • 29. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Working with Batch Files • Batch files are text files that store a series of commands – One command on each line – Batch files use the .BAT extension – Batch files may be edited with any text editor • Notepad • EDIT – Batch files get their own type of icon
  • 30. © 2007 The McGraw-Hill Companies, Inc. All rights reserved EDIT • EDIT is a command-line command that starts a basic text editor
  • 31. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Creating a Batch File • Using EDIT, type in some commands on their own line (such as cd: and Dir) • Save the file with a .BAT extension – C:test.bat • Launch a command prompt and run the batch file C:> CD C:> Test.bat
  • 32. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Additional Commands • Some additional commands are – VER shows the current version of Windows – ECHO tells the batch file to put text on the screen – TYPE displays the contents of a batch file on the screen – SET display settings that Windows has loaded by default
  • 33. © 2007 The McGraw-Hill Companies, Inc. All rights reserved ECHO Command • ECHO will display text on the screen • ECHO OFF turns off the display of text on the screen • @ at the beginning of a line prevents displaying the command, but not the result of the command • @ECHO OFF is frequently used in batch files to “clean up” the appearance when the batch file is run
  • 34. © 2007 The McGraw-Hill Companies, Inc. All rights reserved SET and PATH Commands • SET will display the list of settings that Windows loads by default • Programs (and batch files) are run from the location where the prompt is – If the program is not located in the current folder, you receive an error message – To tell your command to look in other places, use the PATH command • PATH by itself lists the current list of places to look for a program • PATH= location; location; location; … will add locations
  • 35. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Beyond A+
  • 36. © 2007 The McGraw-Hill Companies, Inc. All rights reserved Using Special Keys • F1 function key brings back the previous command one letter at a time • F3 function key brings back the entire command at once • The DOSKEY command stores a list of all previously typed commands and can be accessed by using the up arrow key – Type DOSKEY – Windows XP/2000 automatically starts the program
  • 37. © 2007 The McGraw-Hill Companies, Inc. All rights reserved COMPACT Command • COMPACT – Displays or alters the compression state of files – compact /c
  • 38. © 2007 The McGraw-Hill Companies, Inc. All rights reserved CIPHER Command • CIPHER – Displays or alters the encryption state of files – /e specifies encryption operation – /a says to apply it to the files as well as the directory

Editor's Notes

  • #8: Windows Filenames Windows allows a lot of freedom in file naming, but it still has a handful of characters that you can’t use for file or folder names: / \ [ ] | ÷ + = ; , * ? Filenames may be up to 255 characters in length
  • #12: Windows calls all folders folders except for the root, which still gets the old term directory, as in root directory. In practice, though, the terms directory and folder are interchangeable. Some techs split hairs and call these data containers folders when you’re in the GUI, but directories when you’re at a command prompt. It’s the same thing!
  • #13: Tech Tip Directory trees It helps to visualize a directory tree as upside down, because in geek speak, the trunk, or “root directory”, is spoken of as if it were “above” the folders that divide it up, and those subfolders are spoken of as being “above” the folders into which they are divided. For example, “The file is in the Adobe folder under Program Files.”
  • #18: Tech Tip Error messages are good! Let’s talk about errors in general for a moment, not just command-prompt errors like “Invalid directory,” but any error, including Windows errors. Many new computer users freeze in horror when they see an error message. Do not fear error messages. Error messages are good! They will save you. Seriously, think how confusing it would be if the computer didn’t tell you when you messed up. Error messages tell us what we did wrong so we can fix it. You absolutely cannot hurt your PC in any way by typing the DIR or CD commands incorrectly. Take advantage of this knowledge and really experiment. Intentionally make mistakes to familiarize yourself with the error messages. Have fun. Learn from errors.
  • #20: The Windows command-line interface almost never tells you that a command has been performed successfully. But be assured it will complain when you do something wrong! The old adage is, “DOS never pats you on the back, but it will slap you in the head!”
  • #21: The RD command in Windows NT, 2000, and XP will delete populated directories—that is, directories containing files or subdirectories. Use the /S switch: Type RD /S and the directory name.
  • #22: By and large, you can’t run Windows GUI-based applications within a command-line environment. Most will simply pop open in their own window, just as if you opened them from the Start menu. Try typing SYSEDIT at the command prompt within Windows and see what happens!
  • #30: Most of the keyboard shortcuts used in WordPad, Word, and so on, were first used in the EDIT program. If you know keyboard shortcuts for WordPad or Word, many will work in EDIT.
  • #31: Don’t try using the TYPE command on anything other than a text files—the results will be unpredictable.
  • #32: Don’t try using the TYPE command on anything other than a text files—the results will be unpredictable.
  • #36: With Windows 2000/XP, you can use the up and down arrow keys on the keyboard to scroll through previously typed commands.
  • #38: When using the COMPACT and CIPHER commands, you must type in spaces between multiple parameters (for example, switches and filenames).