Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-05

TProcess, Batch script and Windows

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marcos Douglas

Hi,

I want to execute a batch file on Windows (FPC 2.6.2 and Laz trunk) using TProcess class.
It ONLY works if I use the [poWaitOnExit] and DO NOT USE [poNoConsole] options.

I do not want to see the console so, I need to use [poNoConsole] option. Is this a bug?

I'm sending a project test in attachment. Thanks,

Best regards,
Marcos Douglas

Michael Van Canneyt
to Marcos Douglas
Marcos Douglas wrote 8 lines
Hi, I want to execute a batch file on Windows (FPC 2.6.2 and Laz trunk) using TProcess class. It ONLY works if I use the [poWaitOnExit] and DO NOT USE [poNoConsole] options. I do not want to see the console so, I need to use [poNoConsole] option. Is this a bug?

As far as I know, batch files need CMD and that needs a console ?

Michael.

Marcos Douglas
to Michael Van Canneyt: As far as I know, batch files need CMD and that needs a console ? Michael.
Michael Van Canneyt wrote 16 lines
On Wed, 15 May 2013, Marcos Douglas wrote: > Hi, > > I want to execute a batch file on Windows (FPC 2.6.2 and Laz trunk) > using TProcess class. > It ONLY works if I use the [poWaitOnExit] and DO NOT USE [poNoConsole] > options. > > I do not want to see the console so, I need to use [poNoConsole] > option. Is this a bug? As far as I know, batch files need CMD and that needs a console ?

I saw then:
http://www.freepascal.org/docs-html/fcl/process/tprocess.options.html

poNoConsole = Do not allow access to the console window for the process (Win32 only)

So the "correct" is do not use poNoConsole!

I saw after:
http://www.freepascal.org/docs-html/fcl/process/tprocess.showwindow.html

TProcess.ShowWindow = Determines how the process main window is shown (Windows only)

I do not understood why the interface of TProcess have a property that only works on Windows... but works.

Thank you anyway.
Marcos Douglas

Mark Morgan Lloyd
to Michael Van Canneyt: As far as I know, batch files need CMD and that needs a console ? Michael.
Michael Van Canneyt wrote 13 lines
On Wed, 15 May 2013, Marcos Douglas wrote: > Hi, > > I want to execute a batch file on Windows (FPC 2.6.2 and Laz trunk) > using TProcess class. > It ONLY works if I use the [poWaitOnExit] and DO NOT USE [poNoConsole] > options. > > I do not want to see the console so, I need to use [poNoConsole] > option. Is this a bug? As far as I know, batch files need CMD and that needs a console ?

For completeness: I've certainly got a Delphi program that can "shell out" to cmd in its main window, but it was non-trivial to code.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]