Hello world,
I tried to apply the 'Exec'-command to derive laptop parameters to be used in one of my programs. Unfortunately I'm not able to detect the defined output files on my laptop.
In case somebody can point out what's wrong in below source code that would be great.
In case I run both commands directly by cmd -> set > e:\set_test.txt or wmic bios > e:\bios_test.txt I get the desired output files without a problem.
program test (input,output);
uses
crt, dateutils, dos, math, strutils, sysutils, video;
var
iDosError: integer;
wDosExitCode: word;
begin
{ begin of initialization }
iDosError:= 32767;
wDosExitCode:= 65535;
{ end of initialization }
Exec('set',' > e:\set_test.txt');
wDosExitCode:= lo(DosExitCode);
iDosError:= DosError;
Exec('wmic','bios > e:\bios_test.txt');
wDosExitCode:= lo(DosExitCode);
iDosError:= DosError;
end.
On first 'Exec'-command the parameter values become:
wDosExitCode:= 2 => file does not exist
iDosError:= 0 => no problems
On second 'Exec'-command the parameter values become:
wDosExitCode:= 0 => no problems
iDosError:= 234 => runtime error 'More data is available'