Pascal Exec command in Windows XP Environment 
Author Message
 Pascal Exec command in Windows XP Environment


i want to program in turbo Pascal a tool to add windows 2000 users.
The problem is that the exec-procedure returns dos error-codes (2,3,5 or 8).
I've tried different syntax and methods but i did not suceed.

Can you tell me the syntax for executing the file "net.exe" in
an windows 2000 environment?

It could be also a problem concerning the memory management under windows 2000.
Then is there an alternative to Exec()-Procedure?

Thanky for your help!

Stefan



Wed, 16 Nov 2005 05:59:17 GMT  
 Pascal Exec command in Windows XP Environment



Quote:

> i want to program in turbo pascal a tool to add windows 2000 users.
> The problem is that the exec-procedure returns dos error-codes (2,3,5
or 8).
> I've tried different syntax and methods but i did not suceed.

> Can you tell me the syntax for executing the file "net.exe" in
> an windows 2000 environment?

> It could be also a problem concerning the memory management under
windows 2000.
> Then is there an alternative to Exec()-Procedure?

normally

Swapvectors;
exec(getenv('comspec'),' /c net.exe');
Swapvectors;

does the trick

getenv('comspec')

returns the name and address of the command.com program or the
equivalent in the windows version you are using.

/C

means that you are calling the command program for executing a command,
and the command is a call to the program.
This way I can start most windows programs. Sometimes a program needs
the START command, e.g.

swapvectors;
exec(getenv('COMSPEC'),'/C start WMPLAYER.exe
c:\windows\media\ding.wav');
swapvectors;

hth
--
Femme



Wed, 16 Nov 2005 06:21:00 GMT  
 Pascal Exec command in Windows XP Environment

Quote:




> > i want to program in turbo pascal a tool to add windows 2000 users.
> > The problem is that the exec-procedure returns dos error-codes (2,3,5
>  or 8).
> > I've tried different syntax and methods but i did not suceed.

> > Can you tell me the syntax for executing the file "net.exe" in
> > an windows 2000 environment?

> > It could be also a problem concerning the memory management under
>  windows 2000.
> > Then is there an alternative to Exec()-Procedure?

> normally

> Swapvectors;
> exec(getenv('comspec'),' /c net.exe');
> Swapvectors;

> does the trick

> getenv('comspec')

> returns the name and address of the command.com program or the
> equivalent in the windows version you are using.

> /C

> means that you are calling the command program for executing a command,
> and the command is a call to the program.
> This way I can start most windows programs. Sometimes a program needs
> the START command, e.g.

> swapvectors;
> exec(getenv('COMSPEC'),'/C start WMPLAYER.exe
> c:\windows\media\ding.wav');
> swapvectors;

> hth

Thank you for your answer. I tried it and each run doserror 8. I think
it has to do something with the memory, is that right?

Here is my source-code:

program test;

uses dos;

begin
swapvectors;
exec(Getenv('comspec'),'/c start c:\net.exe');
swapvectors;
writeln(doserror);
readln;
end.

Hopes this helps...

HDT



Wed, 16 Nov 2005 13:22:55 GMT  
 Pascal Exec command in Windows XP Environment




Quote:

bericht


> > > i want to program in turbo pascal a tool to add windows 2000
users.
> > > The problem is that the exec-procedure returns dos error-codes
(2,3,5
> >  or 8).
> > > I've tried different syntax and methods but i did not suceed.

> > > Can you tell me the syntax for executing the file "net.exe" in
> > > an windows 2000 environment?

> > > It could be also a problem concerning the memory management under
> >  windows 2000.
> > > Then is there an alternative to Exec()-Procedure?

> > normally

> > Swapvectors;
> > exec(getenv('comspec'),' /c net.exe');
> > Swapvectors;

> > does the trick

> > getenv('comspec')

> > returns the name and address of the command.com program or the
> > equivalent in the windows version you are using.

> > /C

> > means that you are calling the command program for executing a
command,
> > and the command is a call to the program.
> > This way I can start most windows programs. Sometimes a program
needs
> > the START command, e.g.

> > swapvectors;
> > exec(getenv('COMSPEC'),'/C start WMPLAYER.exe
> > c:\windows\media\ding.wav');
> > swapvectors;

> > hth

> Thank you for your answer. I tried it and each run doserror 8. I think
> it has to do something with the memory, is that right?

> Here is my source-code:

add the fololowing line

Quote:
> program test;

  {$M 8192,0,0}

Quote:
> uses dos;

> begin
> swapvectors;
> exec(Getenv('comspec'),'/c start c:\net.exe');
> swapvectors;
> writeln(doserror);
> readln;
> end.

By default TP reserves all the dos memory remaining for itself, unless
you tell him to leave some room for other programs.

This is an exerpt from the BP help file

  DosError (variable)     (WinDos unit and Dos unit)
  ___________________________________________________
 DosError is used by many of the routines in the Dos and
 WinDos units to report errors.

  var DosError: Integer;  {Error status variable}

 The values stored in DosError are DOS error codes.

 A value of 0 indicates no error; other possible error
 codes are as follows:

  Code | Meaning
  -----?------------------
    2  | File not found
    3  | Path not found
    5  | Access denied
    6  | Invalid handle
    8  | Not enough memory
   10  | Invalid environment
   11  | Invalid format
   18  | No more files

hth

--
Femme



Wed, 16 Nov 2005 19:43:58 GMT  
 Pascal Exec command in Windows XP Environment


online.de> posted at Fri, 30 May 2003 22:22:55 :-

Quote:

>Here is my source-code:

>program test;

>uses dos;

>begin
>swapvectors;
>exec(Getenv('comspec'),'/c start c:\net.exe');
>swapvectors;
>writeln(doserror);
>readln;
>end.

Read TSFAQP #9, especially the line marked (* <-- Important *).

If you use TSFAQP before posting here, you can save us time.
If you use TSFAQP before programming, you can save yourself time.

--

  <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
  <URL:http://www.merlyn.demon.co.uk/clpb-faq.txt>   RAH Prins : c.l.p.b mFAQ;
  <URL:ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip> Timo Salmi's Turbo Pascal FAQ.



Thu, 17 Nov 2005 05:30:49 GMT  
 Pascal Exec command in Windows XP Environment

Quote:






>  bericht


> > > > i want to program in turbo pascal a tool to add windows 2000
>  users.
> > > > The problem is that the exec-procedure returns dos error-codes
>  (2,3,5
>  or 8).
> > > > I've tried different syntax and methods but i did not suceed.

> > > > Can you tell me the syntax for executing the file "net.exe" in
> > > > an windows 2000 environment?

> > > > It could be also a problem concerning the memory management under
>  windows 2000.
> > > > Then is there an alternative to Exec()-Procedure?

> > > normally

> > > Swapvectors;
> > > exec(getenv('comspec'),' /c net.exe');
> > > Swapvectors;

> > > does the trick

> > > getenv('comspec')

> > > returns the name and address of the command.com program or the
> > > equivalent in the windows version you are using.

> > > /C

> > > means that you are calling the command program for executing a
>  command,
> > > and the command is a call to the program.
> > > This way I can start most windows programs. Sometimes a program
>  needs
> > > the START command, e.g.

> > > swapvectors;
> > > exec(getenv('COMSPEC'),'/C start WMPLAYER.exe
> > > c:\windows\media\ding.wav');
> > > swapvectors;

> > > hth

> > Thank you for your answer. I tried it and each run doserror 8. I think
> > it has to do something with the memory, is that right?

> > Here is my source-code:

> add the fololowing line

> > program test;

>   {$M 8192,0,0}

> > uses dos;

> > begin
> > swapvectors;
> > exec(Getenv('comspec'),'/c start c:\net.exe');
> > swapvectors;
> > writeln(doserror);
> > readln;
> > end.

> By default TP reserves all the dos memory remaining for itself, unless
> you tell him to leave some room for other programs.

Thanky for your help. It works fine now!


Thu, 17 Nov 2005 17:11:02 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Windows XP Turbo Pascal PIF Problem

2. Free pascal & Windows XP

3. Delphi Access BDE driver and Windows Office XP/2000 with Windows XP or Windows 2000 ??

4. Turbo Pascal 7 Exec Command Trouble

5. exec command whit FPK Pascal

6. The EXEC command in Turbo Pascal 7.0....

7. Compatability of IDAPI and Windows NT/2000/XP...

8. VESA driver for Windows XP

9. TP7 Graph unit, conflicts with windows XP ?

10. BP and TP under Windows XP

11. Dos environment commands

12. TP writing to DOS Environment (SET command)

 

 
Powered by phpBB® Forum Software