Command Prompt DOS - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Command Prompt DOS

Description:

Command Prompt. DOS & Linux/UNIX ... 32-bit XP command shell. Start run command.com. DOS 7 ... Bootable diskette or CD. Win 9x: 'restart in MS-DOS mode' ... – PowerPoint PPT presentation

Number of Views:184
Avg rating:3.0/5.0
Slides: 21
Provided by: davidt
Category:

less

Transcript and Presenter's Notes

Title: Command Prompt DOS


1
Command PromptDOS Linux/UNIX
  • David Turton
  • Conestoga College
  • Institute of Technology Advanced Learning
  • http//www.conestogac.on.ca/dturton
  • Doon 1D17 x3610

2
Accessing a Command Prompt(Windows)
  • Start?run?cmd.exe
  • 32-bit XP command shell
  • Start?run?command.com
  • DOS 7 closer to true DOS, simulated real
    environment
  • May be able to run older programs here
  • Start?programs?accessories?command prompt
  • Same as cmd.exe
  • Bootable diskette or CD
  • Win 9x
  • "restart in MS-DOS mode"
  • Hold F8 key while booting, select command prompt

3
File/Folder Names(Windows, mainly)
  • long names names with spaces
  • enclose in quotes
  • to keep together as one name
  • can use truncated DOS 8.3 equivalent
  • "My long ugly file name.doc"
  • mylong1.doc
  • use in DOS (vs XP) command-prompt
  • syntax
  • max 255 characters
  • any character except
  • \ / ? " gt lt
  • UNIX/Linux
  • Max 255 characters
  • anything except /
  • file extension (Windows)
  • everything after last period
  • denotes file type
  • program to handle it
  • executable extensions
  • .exe .com .bat .sys

4
Addressing
  • working directory
  • your current location in the directory tree
  • Assumed target for all of your commands
  • DOS prompt shows current directory C\utilitiesgt
  • If not, enter the command prompt pg
  • relative addressing
  • relative to the working directory
  • absolute addressing
  • from the root of the file system
  • Path starts with \ (after drive letter, if used)

5
Prompt shows working (or "current") directory
Command (del) relative reference to a file
Command (copy) with absolute reference to source
file, relative reference to target directory
6
Absolute Addressing
  • Always starts with \
  • May be preceded by a drive letter (C)
  • Otherwise current drive assumed
  • the working directory is irrelevant
  • used when you
  • know where the file is, but not sure of what the
    working directory on that drive is
  • want a specific instance of like-named files

7
Relative Addressing
  • oriented relative to the working directory
  • assume working directory c\tom
  • docs\resume
  • the resume file in my (toms) docs directory
  • .. means the parent (prior) directory level
  • ..\carol\docs\resume
  • go up 1 level, then down to carols docs
    directory to get the resume file
  • . means this directory the current working
    directory
  • copy docs\resume .
  • Copies resume file from docs directory to current
    working directory

8
DOS Wildcards
  • placeholders used to shorten names
  • zero or more of any character
  • ?
  • 1 only 1 of any character
  • dir txt
  • list any file-name that has zero or more
    characters followed by "txt"
  • dir .txt
  • List any file-name ending with the file extension
    ".txt"
  • cd my
  • change directory to one that starts with "my"
    followed by zero or more of any character such
    as "My Documents" or "mylar.2005"
  • Won't work if 2 directories fit pattern.

9
DOS redirection
  • normally output is to console, input from
    keyboard
  • can redirect output of a command to
  • a printer
  • dir c\davestuff gt lpt1
  • or a file
  • type mySpecs.txt gt \temp\anotherFile.txt
  • can pipe output to
  • another program's input queue
  • dir c\ /s more

10
DOS Command Syntax
  • command filelist options
  • file-names are space-delimited
  • destination file-name is always last
  • copy a.txt c\myDir
  • options denoted by "/"
  • xcopy c\accounts e\backup /s /c /y
  • options may have own parameters
  • Separated from option by
  • format a /f1.44 /vlabel

11
Getting help(Windows/DOS)
  • help
  • Lists all supported commands
  • help xcopy
  • Get help on xcopy command
  • xcopy /?
  • Get help on xcopy command
  • Most commands support the /? option
  • Windows XP start?help
  • Search for command-line reference a-z
  • When you don't know which command to use

12
DOS Commandsnote these are NOT case sensitive
  • c
  • Make c drive current location
  • cd \utilities
  • Change current working directory to utilities
    folder
  • mkdir or md
  • make a directory
  • rmdir or rd
  • remove directory, if empty
  • /s remove sub-folders files as well
  • exit
  • terminate command prompt
  • dir c\utilities
  • List directory utilties
  • default current directory
  • options
  • /p
  • pause after each screen
  • /w
  • "wide" format names in columns
  • /s
  • subdirectories too
  • /x
  • show 8.3 filename too

13
DOS commands cont'd
  • edit myFile.txt
  • nice text editor
  • erase myFile
  • erase all files that start with "myFile" in
    current folder
  • ren myFile.txt memo.txt
  • rename myFile.txt to memo.txt
  • copy x y
  • if only 1 file-name
  • copy file into current folder
  • 2 names
  • last name is the target
  • if "y" is folder copies file "x" into it
  • else creates a copy of file "x" called "y"
  • gt2 names
  • last name had better be a folder
  • same if source name is a folder
  • DOS need "" between source names

14
DOS commands cont'd
  • xcopy
  • more options than copy
  • /s
  • copy subfolders as well
  • /d03/14/04
  • only files modified on 14Mar04
  • /y
  • don't prompt when overwriting
  • /a
  • only files with archive bit set
  • etc.
  • attrib a myFile.txt
  • display or change file attributes
  • h -h
  • add/remove "hidden"
  • r -r
  • add/remove "read-only"
  • a -a
  • add/remove "archive"
  • del a b
  • Delete files a and b

15
Batch Filesaka scripts in UNIX/Linux
  • files with extension .bat
  • in current folder or folder on PATH
  • contains DOS commands
  • executed sequentially
  • have conditional commands
  • for, while, if
  • can jump sequence
  • goto

16
scheduled tasksgood use for batch files
  • from control panel
  • tasks run
  • daily
  • weekly
  • weekdays
  • monthly
  • etc.

17
(No Transcript)
18
Disk error checks
  • chkdsk c /f
  • check c for errors and fix them
  • from DOS prompt
  • scandisk c
  • older only Win 9x
  • like chkdisk
  • better with windows up
  • defrag
  • defragment a drive
  • debug
  • try it!
  • well, try the help prompt for it first
  • Win XP facility
  • chkdsk still works
  • Via a clean boot
  • need to disable some things
  • else chkdsk restarts

19
Clean Boot for Windows XPMs article 310353
  • run ? msconfig
  • general tab
  • ? selective startup
  • clear
  • system.ini,
  • Win.ini,
  • startup items,
  • load system services
  • services tab
  • check
  • Hide all Microsoft Services, Disable All
  • OK ? restart Windows
  • chkdisk defrag
  • keep restarting
  • never finish
  • need to disable
  • startup programs
  • settings
  • drivers
  • reset from clean boot
  • general tab ? click Normal startup

20
Networking
  • ipconfig /all
  • win NT/2000/XP/2003
  • IP info address, default g/w, etc.
  • /renew /release
  • contact DHCP for IP address
  • winipcfg
  • win 9x
  • IP info
  • ping 142.156.121.13
  • ask for echo response
  • used to check if up accessible
  • ping www.tse.com
  • find IP of URL
  • see if DNS is available
  • ping the IP address
Write a Comment
User Comments (0)
About PowerShow.com