E-Content of
IT TOOLS AND BUSINESS SYSTEM
Chapter: 3.7 Drives
Topic: 3.7.1 Drives
Drives
      Drives are logical partitions of the hard disk or may be extension to the hard disk.
        A convention is followed while giving names to these partitions. For example, A:,
       B: represents Floppy disk. C:, O:, E: represents Hard Disk, and F:, G: represents
       the Compact Disk.
      To switch from one drive to another, only the drive letter followed by a colon
       needs to be specified. For example, at C:\> type A: and press <Enter>. This will
       take you to A:
      While doing any directory or file manipulation user must take note of your
       location.
        Location of a file or directory always starts with the drive letter (which is the root)
       followed by the name of its parent in one order and finally its own name.
        For example, C:\Program Files\Microsoft Office\Office\MS Word
      Implies that the root is C:\, one of the folders in C:1 is Program Files, Program
       Files contains Microsoft Office folder, which in turn contains office folder, which in
       turn contains MS Word.
                                                                                       Page | 69
                                  E-Content of
                        IT TOOLS AND BUSINESS SYSTEM
Chapter: 3.4 Command prompt
Topic: 3.4.1 Command prompt
Command prompt
     Command Prompt is a command line interpreter application available in most
      Windows operating systems.
     The Command Prompt program allows the user to work in an environment that
      looks more like a traditional operating system as opposed to the icon based
      Windows environment.
     Command Prompt is officially called Windows Command Processor but is also
      sometimes called the command shell or by its file name cmd.exe.
     In Command Prompt, only keyboard can be used and mouse cannot be used.
     Command Prompt works at a lower level than Windows. This means that user
      will have more control over the machine.
     The disadvantage of command prompt is that it is not user-friendly.
     The GUI based operating system made command prompt boring.
                                                                            Page | 55
                                  E-Content of
                        IT TOOLS AND BUSINESS SYSTEM
Opening a command prompt:
      There are two conventional ways to start a Command prompt.
        Start->Programs-> Accessories->Command prompt
        Start->Run and type "cmd" and press enter.
      The Command Prompt shows up as a black terminal window. The command
       prompt should look something like: C:\>
                             FIG 3.62: Command prompt
Directory Navigation
      Navigating the command prompt, as well as changing drives and directories is
       important skill to have. To do this, you must learn a few commands that you must
       enter into the command prompt.
      Changing directories (or changing your path) in the command prompt makes use
       of the CD command. The CD command has a small amount of possible
       arguments. CD accepts a drive and a path.
      Some of the key commands are:
        CD ( Change Directory) : The CD command is very simple to use. All
          commands are relative to the directory that you are in. Therefore, using the
          example output of a "dir" that is shown above, if you want to change to the
          "Windows" directory, you would type
                                                                               Page | 56
                             E-Content of
                   IT TOOLS AND BUSINESS SYSTEM
 CD Windows : If you want to change to the "system" directory (which is a sub
   directory of "windows"), you would enter
 CD System : However if you knew that you wanted to change to the system
   directory immediately, you could type this command.
 CD Windows\System : However if you were already deep in another
   directory (for example c:\ documents and settings \username\ local settings)
   and then wanted to move directly to windows\system then you can do that by
   putting in an initial backwards slash.
 CD \Windows\System : This tells the command to go to the root of the drive,
   then to the directory Windows and system.
 Moving Back Up : You can also move back up the tree, instead of down.
 cd \ or cd\ : to just return to the root of the drive (C:\)
 cd.. : to just go back one level (to use the earlier example, you were in
   c:\windows\system and you wanted to be in c:\windows).
 cd program files or cd "program files" : to access a totally different
   directory, for example "Program Files". When typing directories to change to,
   if the directory name is unique, then you can use wild cards. For example : cd
   program.
 dir - This command will list all of the folders and files in the directory you are
   currently at.
 cd folder - This command will move you to the folder that you specify. The
   folder must be in the directory you are currently in. For example: If you are
   currently at C:\Users\username\ and you enter cd desktop you will be taken
   to C:\Users\username\Desktop\
 cd path - This command will take you to a specific path on your computer.
   You do not need to be in the same directory as the path. You must enter the
   entire path for it to work. For example: cd C:\Windows\System32
 driveletter: - This command will take you to the drive letter that you specify.
   The drive you specify will need to be active, or have a disc in it if it a CD\DVD
   drive. For example, if you want to switch to your D drive, you would enter the
   command D:
                                                                           Page | 57
                                    E-Content of
                          IT TOOLS AND BUSINESS SYSTEM
        exit - This command will exit the Command Prompt, no matter your current
          location.
Path setting:
      Users can run an executable from windows command prompt either by giving the
       absolute path of the file or just by giving the executable file name.
      In the latter case, Windows searches for the executable in a list of folders which
       is configured in environment variables. These environment variables are as
       below.
       1. System path
       2. User path.
      The values of these variables can be checked in system properties( Run
       sysdm.cpl from Run or computer properties).
      Initially user specific path environment variable will be empty. Users can add
       paths of the directories having executables to this variable.
      Administrators can modify the system path environment variable.
To set path from command line
      In Vista, Windows 7 and Windows 8 we can set path from command line using
       ‗setx‘ command. setx path "%path%;c:\directoryPath"
      For example, to add c:\dir1\dir2 to the path variable, we can run the below
       command. setx path "%path%;c:\dir1\dir2"
      Alternative way is to use Windows resource kit tools ‗pathman.exe‗. Using this
       command we can even remove a directory from path variable.
   1. System path environment variable:
      Open administrator command prompt and Run the below command
        To add directory to the system path environment variable.
        Syntax : pathman /as directoryPath
                                                                                Page | 58
                                    E-Content of
                          IT TOOLS AND BUSINESS SYSTEM
        To remove path from system path environment variable.
        Syntax : pathman /rs directoryPath
   2. Setting user path environment variable
      For user environment variables, admin privileges are not required. We can run
       the below command to add and remove a directory to user path environment
       variable.
        To add a directory from user path, user can run the below command.
        Syntax : pathman /au directoryPath
        To remove a directory from user path, user can run the below command.
        Syntax : pathman /ru directoryPath
Creating And Using Batch File
      A script or text file which contains a series of commands to be executed by the
       command interpreter is called as batch files.
      Batch files are created to automate frequently performed tasks.
      A batch file may have any constructs that enables conditional branching and
       looping within the batch files.
      Batch files are simply text files, which is created using Windows notepad
       application. It should be created only using notepad, Other word processing
       applications should not be used as they stores the files by adding their own
       formats.
      Batch file is created by typing the command to run, in a text file and saving with
       the .BAT extension.
                                                                                Page | 59
                                      E-Content of
                            IT TOOLS AND BUSINESS SYSTEM
Chapter: 3.5 Files
Topic: 3.5.1 Files
Files
       Files are logical containers of data that are always present at the leaf level of a
        directory tree, i.e., they are the last element of any tree.
       A file cannot be a collection of other files or directories and can only contain
        data or instructions.
       Each file has a set of properties associated with it, such as
         Size
         Date created
         Date accessed
         Date modified
         Path
         File name
       File name
         Each file is recognized by its filename. Filename has two parts; name and
           extension. File naming conventions must be followed while naming a file. A
           filename can have a maximum of 8 characters.
         Extension identifies the type of the file or the application to which a particular
           file belongs. It can be 3 characters long.
       Size
         Size determines how much space the file is occupying on the disk.
       Date created
         Data created corresponds to the date when file was created.
       Date accessed
         Data accessed corresponds to the date when file was last accessed.
       Date modified
         Data modified corresponds to the date when file was last modified.
                                                                                     Page | 60
                                  E-Content of
                        IT TOOLS AND BUSINESS SYSTEM
   Path
     Path specifies the location of file on the disk. It comprises of a series of
       predecessor (parent) directories and moves up to the root.
   A file has a certain defined structure which depends on its type
     Text file
     Source file
     Object file
     Executable file
   Text file
     Sequence of characters organized into lines.
   Source file
     Sequence of sub routines and functions each of which is further organized as
       declarations followed by executable statements.
   Object file
     Sequence of bytes organized into blocks understandable by the system's linker
   Executable file
     Series of code sections that the loader can bring into memory and execute.
                                                                              Page | 61
                                        E-Content of
                              IT TOOLS AND BUSINESS SYSTEM
Chapter: 3.6 Directories and its Structure
Topic: 3.6.1 Directories and its Structure
Directories and its Structure
      Directories are a collection of files or other directories.
      Directory at the highest level is called the root directory.
      There can be only one root in a directory structure.
      Directories at lower levels are called child and those who share the same parents
       are called siblings.
      A directory structure can be viewed as a way to organize files on the hard disk.
                                  FIG 3.63: Directory Structure
Operations on a directory
      The directory can be viewed as a symbol table that translates file names into
       their directory entries.
      The operations that can be performed on the directory are:
      Search for a file
        Find the entry for a particular file.
      Create a file
        Create new file and add to directory.
      Delete a file
                                                                                   Page | 62
                                     E-Content of
                           IT TOOLS AND BUSINESS SYSTEM
        Remove a file when no longer needed.
      List a directory
        List the files in a directory and the contents of the directory entry for each file
          in the list.
      Rename a file
        Change name of a file as per user‘s request.
        Position within the directory may also change.
      Traverse the file system
        Every directory and every file within a directory structure should be
          accessible.
        Magnetic tape is the commonest backup device.
Directory Structure
      The directory structure is the organization of files into a hierarchy of folders.
      It should be stable and scalable; it should not fundamentally change, only be
       added to.
      Types of directory structure
        Single-level directory
        Two-level directory
        Tree structured directory
        Acyclic graph directory
        General graph directory
Single-level directory
      A single-level directory with file entries for all users contained in the same
       directory.
      It is the simplest structure of all directories.
      All files are in the same directory.
      It is easy to support and understand.
      Name collision problem - files must have unique names since multiple users
       share same directory.
                                                                                     Page | 63
                                     E-Content of
                           IT TOOLS AND BUSINESS SYSTEM
      Even in case of a single user it is difficult to remember all file names and create
       files with unique names (the naming problem).
      Files are limited in length.
                              FIG 3.64: Single-level directory
Two-level directory
      The standard solution to limitations of single-level directory is to create a
       separate directory for each user.
      System maintains a Master File Directory (MFD).
      A separate directory for each user.
      Easy to support and understand.
        User file directory (UFD).
      User name and a file name constitute a path name.
      Solves the name collision problem.
      Sharing of files by different users is difficult.
                               FIG 3.65: Two-level directory
                                                                                 Page | 64
                                    E-Content of
                          IT TOOLS AND BUSINESS SYSTEM
Tree structured directory
      The two-level directory structure can be extended to a tree of arbitrary height.
      Tree is the most common directory structure.
      Examples of systems supporting tree structure.
        MS-DOS
        UNIX
      A tree has a root directory.
      The root contains a set of directories.
      A directory contains a set of files and other sub directories.
      Each sub directory can further contain a set of files and other sub directories.
      Each file has a unique path name.
                          FIG 3.66: Tree-structured directory
      One bit in each directory entry defines the entry as a file(0) or as a sub
       directory(1).
                                                                                   Page | 65
                                    E-Content of
                          IT TOOLS AND BUSINESS SYSTEM
Path name
      A path name is the path from the root, through all the subdirectories, to a
       specified file.
      Example
        In the figure root/spell/mail/prog/obj is a path.
      Types of path names can be of two types.
        Absolute path name.
        Relative path name.
      Absolute path name
        An absolute path name begins at the root and follows a path down to the
           specified file giving the directory names on the path.
      Relative path name
        A relative path name defines a path from the current directory.
      With reference to figure, if the current directory is root/spell/mail, to reference the
       file list.
      Relative path name: prog/list.
      Absolute path name: root/spell/mail/prog/list.
Acyclic graph directories
      When the same files need to be accessed in more than one place in the directory
       structure ( e.g. because they are being shared by more than one user / process ),
       it can be useful to provide an acyclic- graph structure
      UNIX provides two types of links for implementing the acyclic-graph structure.
        A hard link (usually just called a link) involves multiple directory entries that
           both refer to the same file. Hard links are only valid for ordinary files in the
           same file system.
        A symbolic link, that involves a special file, containing information about
           where to find the linked file. Symbolic links may be used to link directories
           and/or files in other file systems, as well as ordinary files in the current file
           system.
                                                                                     Page | 66
                                    E-Content of
                          IT TOOLS AND BUSINESS SYSTEM
                           FIG 3.67: Acyclic graph directory
General graph directories
      Allow users to create subdirectories in a two-level directory result is a tree
       structured directory.
      Simply adding new files and subdirectories to an existing tree-structured directory
       preserves the tree-structured nature.
      When user add links to a tree, the tree structure is destroyed resulting in a simple
       graph.
      Cycles allowed.
      Cycles might result in an infinite loop while searching.
      One solution is limit to the number of directories which will be accessed during a
       search.
                                                                                  Page | 67
          E-Content of
IT TOOLS AND BUSINESS SYSTEM
FIG 3.68: General graph directory
                                    Page | 68