home *** CD-ROM | disk | FTP | other *** search
- Program GetDrive;
-
- { ** Program that detects current logged Drive
- then reports it as an Errorlevel to DOS **}
-
- Var Current_Dir : String[40];
-
-
- Procedure Syntax;
-
- Begin
- Writeln;
- Writeln('GETDRIVE returns an Errorlevel to DOS depending on the current');
- Writeln('logged Drive: A: --> 0 B: --> 1 C: --> 2 D: --> 3 etc., etc.');
- Writeln;
- Writeln('The correct Syntax is GETDRIVE');
- Writeln;
- Writeln('NOTE: If an Error in detecting the Drive occurs');
- Writeln('then an Errorlevel of 100 will be returned to DOS');
- Writeln;
- Writeln('(c) Barrie Edwards 1990');
- Writeln;
- Halt(100)
- End;
-
-
- Begin
- IF ParamCount > 0 then Syntax; {Explain use of GetDrive}
- {$I-}
- GetDir(0, Current_Dir);
- {SI+}
- If IOResult <> 0 then Halt(100) else {Cannot Read the Disk - report error}
- Halt(Ord(Current_Dir[1])-65)
- End.
-