How to send output to the main program using shell?

DOS specific questions.
Bob Paw
Posts: 8
Joined: Nov 23, 2014 14:22

How to send output to the main program using shell?

Postby Bob Paw » Nov 23, 2014 15:20

Say:

Code: Select all

if shell("if exist settings.txt ...) ... then
dothis
andthis
end if
fxm
Posts: 9620
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: How to send output to the main program using shell?

Postby fxm » Nov 23, 2014 15:52

Code: Select all

If Shell("Echo." + "if exist settings.txt ...") = 0 Then
  Print
  Print "Ouput by Shell() successful"
End If
Sleep
Bob Paw
Posts: 8
Joined: Nov 23, 2014 14:22

Re: How to send output to the main program using shell?

Postby Bob Paw » Nov 23, 2014 18:06

What about, if it exists, sending a variable to the main program?
dkl
Site Admin
Posts: 3211
Joined: Jul 28, 2005 14:45
Location: Germany

Re: How to send output to the main program using shell?

Postby dkl » Nov 23, 2014 19:08

And to read the console output of a launched program, there is Open Pipe:
/wiki/KeyPgOpenPipe
TJF
Posts: 3567
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: How to send output to the main program using shell?

Postby TJF » Nov 23, 2014 20:12

The direct way is often the best ...

Code: Select all

VAR fnam = "settings.txt", fnr = FREEFILE
IF 0 = OPEN(fnam FOR INPUT AS fnr) THEN
  CLOSE #fnr
  ?"Do this ..."
  ?"Do that ..."
END IF

Return to “DOS”

Who is online

Users browsing this forum: No registered users and 3 guests