Well..yes
i'd like to get the output (the text that normally is written in the cmd window)
e.g. when i run shell("cmd.exe","ping 192.x.y.z")
i'd like the result in a b4p variable( or object)
This is possible with PHP, it would be very cool if B4P could also do this
I have a vague recollection that you used to be able to put two commands into the shell on one line, delimited by the "pipe" character (=|), so called because it pipes the stdout of the 1st command to the stdin of the second. I think this was borrowed from Unix. Early usage: "type <file-name> | more"
Would it work with calling a Basic4PPC executable and would that transfer sufficient data in this case?
If you use the Process object from the Threading library you can wait until the command finishes which makes things easier. P is a Process object. Note that all the filenames are explicitly prefixed by AppPath to make sure that files are where you expect them. I had trouble if I left them out - you may or may not experience the same.
Two small comments:
- The file should be opened in ASCII mode as in agraham's example.
- It is better to wrap the path with quotes in case you have spaces in it:
Good point Erel! I'm old-fashioned and don't put spaces in my file and folder names - somehow it just doesn't seem right to do that. I've never really got over the demise of 8.3 filenames .