Running External EXE files from a program [EXEC] 
Author Message
 Running External EXE files from a program [EXEC]

Hi, Please can someone let me know what the standard code would be to
run a program from a turbo Pascal program using pascal.

I.E. I would like to execute and run
c:\windows\win.com

 - - - Within my turbo program


or write back to the newsgroup



Wed, 18 Jun 1902 08:00:00 GMT  
 Running External EXE files from a program [EXEC]

Quote:

> Hi, Please can someone let me know what the standard code would be to
> run a program from a turbo pascal program using pascal.

> I.E. I would like to execute and run
> c:\windows\win.com

>  - - - Within my turbo program

Exec(exefilename,commandstring) works with many application
programs and even with Command.Com, but it will surely NOT
work with WIN.COM!

Franz Glaser



Wed, 18 Jun 1902 08:00:00 GMT  
 Running External EXE files from a program [EXEC]
In comp.lang.pascal.borland, NetUser spluttered:
Quote:
>Hi, Please can someone let me know what the standard code would be to
>run a program from a turbo pascal program using pascal.

>I.E. I would like to execute and run
>c:\windows\win.com

> - - - Within my turbo program

swapvectors;
exec('c:\windows\win.com',' ');
swapvectors;

Make sure that you use the $M memory directive to minimise the heap and
stack or there may not be enough space to run windows.

--
Pedt Scragg

Never challenge a porcupine to an ass-kicking contest



Wed, 18 Jun 1902 08:00:00 GMT  
 Running External EXE files from a program [EXEC]


Quote:

>> Hi, Please can someone let me know what the standard code would be to
>> run a program from a turbo pascal program using pascal.

>> I.E. I would like to execute and run
>> c:\windows\win.com

>>  - - - Within my turbo program

>Exec(exefilename,commandstring) works with many application
>programs and even with Command.Com, but it will surely NOT
>work with WIN.COM!

Why not? Have you tested it?

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 Running External EXE files from a program [EXEC]

Quote:




> >> Hi, Please can someone let me know what the standard code would be to
> >> run a program from a turbo pascal program using pascal.

> >> I.E. I would like to execute and run
> >> c:\windows\win.com

> >>  - - - Within my turbo program

> >Exec(exefilename,commandstring) works with many application
> >programs and even with Command.Com, but it will surely NOT
> >work with WIN.COM!

> Why not? Have you tested it?

Yes. Depends on the version and on the 386-mode.


Wed, 18 Jun 1902 08:00:00 GMT  
 Running External EXE files from a program [EXEC]


Quote:




>> >> Hi, Please can someone let me know what the standard code would be to
>> >> run a program from a turbo pascal program using pascal.

>> >> I.E. I would like to execute and run
>> >> c:\windows\win.com

>> >>  - - - Within my turbo program

>> >Exec(exefilename,commandstring) works with many application
>> >programs and even with Command.Com, but it will surely NOT
>> >work with WIN.COM!

>> Why not? Have you tested it?

>Yes. Depends on the version and on the 386-mode.

Pardon? Sure one cannot load Windows when it is already running, but do
you think there is some special hook in command.com run win.com? Or is
it just run like any other program. The command.com uses very same
system call as exec() to run programs.

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 Running External EXE files from a program [EXEC]


Quote:

>> Hi, Please can someone let me know what the standard code would be to
>> run a program from a turbo pascal program using pascal.

>> I.E. I would like to execute and run
>> c:\windows\win.com

>>  - - - Within my turbo program

>Exec(exefilename,commandstring) works with many application
>programs and even with Command.Com, but it will surely NOT
>work with WIN.COM!

Why not? Have you tested it?

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 Running External EXE files from a program [EXEC]

Quote:




> >> Hi, Please can someone let me know what the standard code would be to
> >> run a program from a turbo pascal program using pascal.

> >> I.E. I would like to execute and run
> >> c:\windows\win.com

> >>  - - - Within my turbo program

> >Exec(exefilename,commandstring) works with many application
> >programs and even with Command.Com, but it will surely NOT
> >work with WIN.COM!

> Why not? Have you tested it?

Yes. Depends on the version and on the 386-mode.


Wed, 18 Jun 1902 08:00:00 GMT  
 Running External EXE files from a program [EXEC]


Quote:




>> >> Hi, Please can someone let me know what the standard code would be to
>> >> run a program from a turbo pascal program using pascal.

>> >> I.E. I would like to execute and run
>> >> c:\windows\win.com

>> >>  - - - Within my turbo program

>> >Exec(exefilename,commandstring) works with many application
>> >programs and even with Command.Com, but it will surely NOT
>> >work with WIN.COM!

>> Why not? Have you tested it?

>Yes. Depends on the version and on the 386-mode.

Pardon? Sure one cannot load Windows when it is already running, but do
you think there is some special hook in command.com run win.com? Or is
it just run like any other program. The command.com uses very same
system call as exec() to run programs.

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 Running External EXE files from a program [EXEC]

Quote:

....
> Pardon? Sure one cannot load Windows when it is already running, but do
> you think there is some special hook in command.com run win.com? Or is
> it just run like any other program. The command.com uses very same
> system call as exec() to run programs.

Osmo,

I do not think that LOADING win.com were a problem, but I
know that Windows, when run, distroys so much of the PC
environment, that the Pascal program in the background can
get a lot of problems on return of Windows. So, it does not
make much sense to start Win from within a Pascal program.

I did forbid to my customers, to invoke Win from the shell
exit.

There are points to consider with open files, with COM ports
and the printer and probably with DPMI or EMS or ...

If the Pascal program is simple and its main job is to start
Windows, then you may be right in many cases.  :-)

Franz Glaser



Wed, 18 Jun 1902 08:00:00 GMT  
 Running External EXE files from a program [EXEC]

Quote:

...
> Pardon? Sure one cannot load Windows when it is already running, but do
> you think there is some special hook in command.com run win.com? Or is
> it just run like any other program. The command.com uses very same
> system call as exec() to run programs.

Osmo,

I do not think that LOADING win.com were a problem, but I
know that Windows, when run, distroys so much of the PC
environment, that the Pascal program in the background can
get a lot of problems on return of Windows. So, it does not
make much sense to start Win from within a Pascal program.

I did forbid to my customers, to invoke Win from the shell
exit.

There are points to consider with open files, with COM ports
and the printer and probably with DPMI or EMS or ...

If the Pascal program is simple and its main job is to start
Windows, then you may be right in many cases.  :-)

Franz Glaser



Wed, 18 Jun 1902 08:00:00 GMT  
 Running External EXE files from a program [EXEC]


Quote:

>...
>> Pardon? Sure one cannot load Windows when it is already running, but do
>> you think there is some special hook in command.com run win.com? Or is
>> it just run like any other program. The command.com uses very same
>> system call as exec() to run programs.

>Osmo,

>I do not think that LOADING win.com were a problem, but I
>know that Windows, when run, distroys so much of the PC
>environment, that the Pascal program in the background can
>get a lot of problems on return of Windows. So, it does not
>make much sense to start Win from within a Pascal program.

Why would Widows do such things?

Quote:

>I did forbid to my customers, to invoke Win from the shell
>exit.

>There are points to consider with open files, with COM ports
>and the printer and probably with DPMI or EMS or ...

I'd never call exec when there are open files. I see no point. Also why
would one call windows when one does communicating.

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 Running External EXE files from a program [EXEC]


Quote:

>Exec(exefilename,commandstring) works with many application
>programs and even with Command.Com, but it will surely NOT
>work with WIN.COM!

That turns out to be, in the words of our greatest parliamentarian, a
terminological inexactitude.

After a fresh boot of in effect a standard 8MB PC, DOS6.20, WgWg3.11,
        C:\>hunt win x p ""
finds WIN.COM, and, given a "Y", executes it.

For the present purpose, HUNT is straightforward, with {$M, SwapVectors,
and in effect Exec(GetEnv('COMSPEC'), ' /C C:\WINDOWS\WIN.COM') ; if I
remember correctly.  HUNT(PAS,EXE) are in programs/

--

  Web <URL: http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
  PAS, EXE in <URL: http://www.merlyn.demon.co.uk/programs/> - see 00index.txt.
  Do not Mail News to me.    Before a reply, quote with ">" or "> " (SoRFC1036)



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Running a batch or EXE file from a TP program

2. Running .EXE files from program

3. How run a program.exe at the end of a pascal program

4. Running external programs

5. FPC Linux - Running External Programs and Capturing Output

6. FPC Linux - Running External Programs and Capturing Output

7. Include external bin code into exe file

8. Running external programs

9. Running external programs with ShellAPI

10. running external programs

11. use exec to run a .bat file - how?

12. Running batch file with exec

 

 
Powered by phpBB® Forum Software