[fpc-pascal]How to call DOS BATCH file?

Martin Hankovec Martin.Hankovec at oku-st.cz
Tue Feb 5 10:49:52 CET 2002


Hello all,
I've a problem. If I try to call DOS .exe program via Exec(...), it works fine. But
if I try to call some batch file in the same path (this batch file calls another exe file),
it doesn't work. It writes, that the specified file isn't name of executable or batch file
(instead of the name of file it maybe writes the character '-' or space). The batch file
exists, of course :-))) and can be run by hand. Location of batch file is OK too, because
another .exe file from the same location can be run via Exec without any problem.

I try it on Win2K, FPC 1.0.2 target Win32.

Can anybody help me, please, correct this problem?

Sources:
------------------
testik.pp:
-----------
Program testik;
uses dos;
begin
  Exec('d:\test.bat','');  {it would call the test.bat batch file}
  readln;                 {wait for pressing Enter}
end.

d:\test.bat: (I've place it to root of D:, on other location is the same problem)
-------------------
d:\Simulator1.exe


(batch calls the "simulator1.exe" file, by hand it works,via FPC doesn't)

Thanks for your advice and wish a nice day

Martin





More information about the fpc-pascal mailing list