EXEC

EXEC Command [ WAIT ] [ FOR ( READ | WRITE | READ WRITE ) [ AS Variable ]

Executes a command. An internal Process object is created to manage the command.

The command must be specified as an array of strings containing at least one element. The first element of this array is the name of the command, and the others are optional parameters.

Lastly, you can get a reference to the internal Process object into a variable Variable by specified the AS keyword.

Example :

' Get the content of a directory

EXEC [ "ls", "-la" ] WAIT

' Same thing, but in background

DIM Content AS String

EXEC [ "ls", "-la" ] FOR READ

...

PUBLIC SUB Process_Write(Data AS String)

  Content = Content & Data
  PRINT Data

END

' If your command expects some arguments in quotes, EXEC can handle that automatically:
' for example perl -e 'print while <>;' becomes

EXEC [ "perl", "-e", "print while <>;" ] FOR READ WRITE


Referenced by :