Registriert seit: 8. Mai 2005
Ort: Sondershausen
4.274 Beiträge
Delphi 6 Personal
|
Re: Ersatz für Batch Befehl CHOICE ?
13. Mai 2006, 11:37
Es gibt ja auch noch Turbo Pascal 5,6,7 oder Delphi 1 oder ...
Delphi-Quellcode:
program dings;
{$M $16000,0,0 }
{----------------------------------------------------------------}
uses Dos;
procedure Exec_(App, Param: string);
begin
SwapVectors;
Exec(App, Param);
SwapVectors;
if DosError <> 0 then
begin
Case DosError of
2: Writeln(' DosError: File not found');
3: Writeln(' DosError: Path not found');
6: Writeln(' DosError: Invalid handle');
8: Writeln(' DosError: Not enough memory');
else WriteLn(' Dos error #', DosError);
end;
Halt;
end;
end;
{----------------------------------------------------------------}
procedure WriteChars(AnyChar: Char; Count: Word; NewLine: Boolean);
var i: Word;
begin
for i := 0 to Count do
Write(AnyChar);
if NewLine then Writeln;
end;
function MyStrToInt(s: string; var i: integer): Boolean;
var
Err: Integer;
begin
val(s, i, err);
if err <> 0 then MyStrToInt := False
else MyStrToInt := True;
end;
var
s: string;
n: Integer;
begin
WriteLn;
WriteChars(' -', 40, TRUE);
WriteLn;
WriteLn(' [1] - Dell Latitude C840');
WriteLn(' [2] - PC001');
WriteLn(' [3] - Abbruch');
WriteLn;
WriteChars(' -', 40, TRUE);
WriteLn;
repeat
Write(' Ihre Auswahl: ');
Readln(s);
if MyStrToInt(s, n) then
begin
case n of
1: Exec_(' c:\net\netbind.com', ' ');
2: Exec_(' c:\net\net.exe', ' ');
3: WriteLn(' Abbruch durch User.');
else Write(' Unzulaessige Eingabe. ');
end;
end else
Write(' Unzulaessige Eingabe. ');
until n in [1..3];
end.
Done.
|
|
Zitat
|