Presentation is loading. Please wait.

Presentation is loading. Please wait.

W INDOWS C OMMANDS. References: Windows Command Line Interface, Prof. Yitzchak Rosenthal 2.

Similar presentations


Presentation on theme: "W INDOWS C OMMANDS. References: Windows Command Line Interface, Prof. Yitzchak Rosenthal 2."— Presentation transcript:

1 W INDOWS C OMMANDS

2 References: Windows Command Line Interface, Prof. Yitzchak Rosenthal 2

3 CLI AND DOS The Windows command line interface (CLI) commands are sometimes referred to as "DOS" commands. DOS was the name of the operating system that predated Windows (it stands for Disk Operating System). The only way to control DOS was to use these commands The commands in the modern Windows Command Line interface are very similar to the original DOS commands.

4 W HY SHOULD WE USE THE CLI (DOS COMMANDS ) ? Many windows users will never have a need for the DOS commands DOS commands are useful or required for many administrative or programming tasks For example, using DOS commands one can write programs to automate many administrative tasks.

5 T HE B ASICS Prompt: what the computer tells you when ready for a command (c:\>) You type a command and press ENTER when you want to send it to the computer Computer may come back with text about what it did (or didn’t do) and then will present the Prompt again. 5

6 A CCESSING THE C OMMAND L INE XP: Run dialog box; type CMD or COMMAND Vista/7: Search Dialog box; same command or start | All Programs | Accessories | Command Prompt or Right-click shortcut and select Run As Administrator for commands that affect Windows Win 8/8.1: Windows Button, CMD 6

7 F OCUS Command Line always focused on a drive and directory; prompt will show both C:\Windows\System32> has focus on C: drive and Windows\System32 folder Change focus – Type drive letter and colon, then ENTER – Type CD and directory name to drill down – Type CD.. To go up a level DOS will remember drive and directory 7

8 F ILENAMES Everything is a file to the computer Each file has a name: 8.3 format Windows allows 255 characters in file name Extension (should be) unique to application that created the file; changing the file extension does not change the file contents Windows uses file extension to determine: a) Program that created it and b) What icon to use for the file 8

9 ASCII American Standard Code for Information Interchange Each unique method of binary organization is called a file format ASCII defines 256 eight-bit characters First, universal, file format still used for configuration files 9

10 F OLDERS Also called directories Any file at the root of the directory tree is said to be in the Root Directory A folder within a folder is a sub-directory or subfolder Any folder can have many subfolders and files; names have to be unique unless in different folders 10

11 P ATH The route to a file; listing of drive and directory structure to get to the file: C:\Windows\System32\Notepad.exe This is the path to the file and its full name 11

12 C OMMAND. COM Shifts command to upper case Looks within command.com Looks within the current directory (focus) Looks in directories specified in the PATH Returns “Bad command or file name” /? Will bring up help on the command 12

13 O H N O ! DOS will do what you say, not what you mean so double-check spelling and syntax before the Enter key is pressed I wanted a directory listing, but I typed DEL instead of DIR 13

14 DIR Shows the contents of the current directory Can show another directory if you point it there: dir c:\windows Dir /w will give you a five-column display Dir /p will pause at each screenful of information 14

15 15 SPACES IN FILENAMES If any folder or filename in a path contains spaces, you must surround the entire path with quotes when using it in a DOS command. Example dir "c:\my folder\my file.txt"

16 CD Change directory CD will take you down to that directory CD.. Will take you up one directory level CD \ will take you to the root directory for the drive 16

17 M OVE BETWEEN DRIVES Type the drive name followed by a colon and then press enter A: will take you to the A: drive C: will take you to the C: drive Command will remember what directory you were in on each drive when you switch 17

18 MD MD to make a directory New directory is directly below current directory Automatically creates. (dot) and.. (double-dot) files. Dot is current directory; double-dot is parent directory (one up) Does not tell you anything if it worked 18

19 RD RD to remove (empty) directory (only. and.. Files remain Removes directory below current directory RD /s will remove files, subdirectories and directory 19

20 R UNNING A P ROGRAM Your computer can only run files with the extensions:.exe,.com or.bat You do not have to type the extension to run the file/program 20

21 ATTRIB Attrib displays the attributes (H,S,R,A) for a file Attrib + turns on the attribute Attrib - turns off the attribute 21

22 W ILDCARDS * (shift-8) replaces any number of characters ? Replaces just one character Can be used anywhere a file name is legal DIR a*.* will find any file that starts with “a” in the directory and has any extension 22

23 REN Renames a file name to a new name REN 23

24 DEL BE VERY CAREFUL WITH THIS COMMAND!!!! Deletes one or more (if you use wildcards) files; all gone, no going back Will not remove directories Actually, replaces the first character with Σ You don’t get a response 24

25 C OPY /M OVE Copy Copy d:\win98\*.* c:\win98\*.* will copy all files from the D: drive (optical drive) win98 directory to the C:\WIN98 directory – will not change file names There is no “undo” for copy/move gone wrong 25

26 XCOPY Allows copying of directories, files and subdirectories at one time Xcopy c:\data d:\data /s/e will copy everything in the c:\data directory to a d:\data directory including files and subdirectories (/s) even if empty (/e) 26 R OBOCOPY Robust copy command Allows you to copy files and directory structures across a network Found in Vista and 7

27 CHKDSK Command line version of Error Check Usually fails when you start it because it can not lock the drive; will run next time Windows restarts 27 F ORMAT We have a whole presentation on this Format c: /s will format c: drive and install system files (DOS)

28 Hostname Will give you the name of the computer SFC System File Checker SFC /scannow Will attempt to set computer disk to be the same as installation disk Shutdown 28

29 | MORE This is what you type followed by the ENTER key ` This is the prompt. It is printed by the computer To view a lot of output, instead of using the scroll bar, you can force the output of most commands to be displayed one screen at a time. Type the command followed by "| more" (without the quotes), for example: c:\> help | more The vertical bar symbol (also called a pipe symbol) is located on the keyboard above the backslash ( \ ) character.

30 30 OUTPUT OF " HELP | MORE " When you use "| more", the output from the command is displayed one screenfull at a time Below is the output of the command "help | more" Press the spacebar to see the next screenfull of output. Press the ENTER key to see the next line of output. To quit seeing the output type "q" (for quit) or Ctrl-C

31 31 U SING “| MORE ” WITH OTHER COMMANDS You can add “| more” (without the quotes) to the end of most commands to have the output of that command displayed one page at a time. E.g. dir | more type myfile.txt | more We will learn more about what the “|” means later.

32 32 C HANGING THE PROPERTIES OF THE COMMAND WINDOW Another way to see more information at once is to increase the height of the command window To do that, "left click" on the icon in the upper left hand corner of the window and choose "Properties"

33 INCREASE THE SIZE OF THE COMMAND WINDOW

34 C HANGING THE PROPERTIES OF THE COMMAND WINDOW Another way to see more information at once is to increase the height of the command window To do that, "left click" on the icon in the upper left hand corner of the window and choose "Properties"

35 35 I NCREASING THE HEIGHT OF THE COMMAND WINDOW choose the "Layout" tab. change the value of the "Height" field in the "Window Size" section this is the number of lines of output that is displayed in the command window. (the default value is 24) press the "OK" button

36 36 A PPLY THE CHANGES finally, you will see this dialog box If you choose "Apply properties to current window only" then the next time you start a command window the new window will be the original size If you choose "Modify shortcut that started this window" then then next time that you start a command window it will be the larger size.

37 37 RESULT - LARGER COMMAND WINDOW

38 38 I NCREASING THE HEIGHT OF THE COMMAND WINDOW choose the "Layout" tab. change the value of the "Height" field in the "Window Size" section this is the number of lines of output that is displayed in the command window. (the default value is 24) press the "OK" button

39 39 A PPLY THE CHANGES finally, you will see this dialog box If you choose "Apply properties to current window only" then the next time you start a command window the new window will be the original size If you choose "Modify shortcut that started this window" then then next time that you start a command window it will be the larger size. Make a choice (either is fine) and press the "OK" button.

40 40 RESULT - LARGER COMMAND WINDOW

41 Windows Command-Line File and Folder Management Tools ToolDescription ATTRIBDisplays, applies, or removes attributes for the specified file or folder. CDChanges to the specified folder. COMPCompares the contents of two specified files byte by byte. COMPACTDisplays or modifies the compression settings for the specified file or folder (which must be located on an NTFS partition). COPYCreates a copy of the specified file or folder in another location. DELDeletes the specified file or folder. DIRDisplays a directory listing for the current folder or for the specified file or folder. FCCompares the content of two specified files. FINDSearches for and displays all the instances of a specified string in a file. FINDSTRUses a regular expression to search for and display all the instances of a specified string in a file. MKDIRCreates the specified folder. MOVEMoves the specified file or folder to another location. RENChanges the name of the specified file or folder. REPLACEReplaces files in the destination folder with files in the source folder that have the same name. RMDIRDeletes the specified folder. SORTSorts the specified file and then displays the results. SFCRuns the System File Checker, which scans and verifies the protected Windows 7 files. TAKEOWNEnables an administrator to take ownership of the specified file. TREEDisplays a graphical tree diagram showing the subfolder hierarchy of the current folder or the specified folder. WHERESearches for and displays all the files that match a specified pattern in the current folder and in the PATH folders. XCOPYCreates a copy of the specified file or folder in another location. This tool offers many more options than the COPY command. 41


Download ppt "W INDOWS C OMMANDS. References: Windows Command Line Interface, Prof. Yitzchak Rosenthal 2."

Similar presentations


Ads by Google