RosettaCodeData/Task/Execute-a-system-command/NetRexx/execute-a-system-command.netrexx
Ingy döt Net 776bba907c Sync
2013-10-27 22:24:23 +00:00

23 lines
649 B
Text

/* NetRexx */
options replace format comments java crossref symbols binary
import java.util.Scanner
runSample(arg)
return
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method runSample(arg) private static
parse arg command
if command = '' then command = 'ls -oa' -- for Windows change to: 'cmd /C dir'
do
say 'Executing command:' command
jprocess = Runtime.getRunTime().exec(command)
jscanner = Scanner(jprocess.getInputStream())
loop label scanning while jscanner.hasNext()
say jscanner.nextLine()
end scanning
catch ex = IOException
ex.printStackTrace()
end
return