FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Get return text of DOS command!?
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Get return text of DOS command!?
Posted: Fri Jun 06, 2008 01:48 PM

Hi friends!

How I can get the return of a line command into DOS with fivewin/xharbour like this:

"tracert -d 10.0.0.1"

Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
Get return text of DOS command!?
Posted: Fri Jun 06, 2008 03:09 PM

tracert -d 10.1.1.1 >> file.txt

memoread file.txt

Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Get return text of DOS command!?
Posted: Fri Jun 06, 2008 06:51 PM
MOISES wrote:tracert -d 10.1.1.1 >> file.txt

memoread file.txt


Thanks Moises, but how I can execute this?

With shellExecute()? winExec() ?
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
Get return text of DOS command!?
Posted: Sat Jun 07, 2008 07:17 AM

Hi,

I'd suggest using the Waitrun(), otherwise the program will continue without the command having finished

Waitrun("tracert.exe -d 10.1.1.1 >> file.txt")

Posts: 464
Joined: Tue May 16, 2006 07:47 AM
Get return text of DOS command!?
Posted: Sat Jun 07, 2008 07:24 AM
Hi JC

You can use the RUN command

 RUN tracert -d 10.1.1.1 >> file.txt
should work.

The more flexible way is as follows:

LOCAL sOSCommand
sOSCommand := "tracert -d 10.1.1.1 >> file.txt"
RUN ( sOSCommand )


Should work fine under Windows. Certainly works under Linux. I recently wrote a "proof of concept" for compiling and linking xHarbour/FiveLinux projects via an xHarbour/FiveLinux "project manager" and the following code ran fine:

FUNCTION Compile( xProject )

LOCAL sOsCommand

sOsCommand := "./m.sh " + xProject + " > " + xProject + ".flb" 
RUN ( sOsCommand )
MsgInfo( MemoRead( xProject + ".flb" ) )

RETURN nil


Hope that helps
xProgrammer

Continue the discussion