Get return text of DOS command!?

Get return text of DOS command!?

Postby JC » Fri Jun 06, 2008 1: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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby MOISES » Fri Jun 06, 2008 3:09 pm

tracert -d 10.1.1.1 >> file.txt

memoread file.txt
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Postby JC » Fri Jun 06, 2008 6: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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby AlexSchaft » Sat Jun 07, 2008 7: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")
User avatar
AlexSchaft
 
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Postby xProgrammer » Sat Jun 07, 2008 7:24 am

Hi JC

You can use the RUN command

Code: Select all  Expand view
RUN tracert -d 10.1.1.1 >> file.txt
should work.

The more flexible way is as follows:

Code: Select all  Expand view
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:

Code: Select all  Expand view
FUNCTION Compile( xProject )

LOCAL sOsCommand

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

RETURN nil


Hope that helps
xProgrammer
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 59 guests