Cómo obtener las variables de entorno del DOS
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
var
Env : PChar;
i : Integer;
S : String;
PosEq : Integer;
begin
Env := GetDosEnvironment;
With ListBox1,StringGrid1 do begin
While Env^ <> #0 do begin
Items.Add(StrPas(Env));
Inc(Env,StrLen(Env)+1);
end;
RowCount := Items.Count;
for i := 0 to Pred(Items.Count) do begin
PosEq := Pos('=',Items[i]);
Cells[0,i] := Copy(Items[i],1,PosEq-1);
Cells[1,i] := Copy(Items[i],PosEq+1,Length(Items[i]));
end;
end;
end;