Doing the same w/ GWBASIC ought to be pretty straightforward. It returned back to the OS via the "SYSTEM" statement. Back in the "day" before I had the QuickBASIC compiler I would invoke GWBASIC programs from batch files in a similar manner, pulling input from STDIN and outputting to STDOUT.