Run a command line process

Added by iNTERFACEWARE

Execute programs and batch files, you can also load results from a directory listing etc.

Source Code
   -- change to the temp directory and run a batch file
   -- for windows
   os.execute('cd C:\\temp')
   os.execute('run.bat')  
   -- alternatively chain the commands together
   os.execute('cd C:\\temp && run.bat')  
   -- for mac/linux
   local D = io.popen('cd "My HD/Users/my-user/Downloads/temp"')
   os.execute('run.sh')  
   -- alternatively chain the commands together
   local D = io.popen('cd "My HD/Users/my-user/Downloads/temp" ; run.sh')

   -- read names of files and directories
   -- for windows
   local D = io.popen('ls')
   local R = D:read('*a')
   -- change to a different directory first
   local D = io.popen('cd C:\\Downloads\\temp')
   local D = io.popen('dir')
   -- alternatively chain the commands together
   local D = io.popen('cd C:\\Downloads\\temp && dir')
   local R = D:read('*a')
   -- for mac/linux
   local D = io.popen('ls')
   local R = D:read('*a')
   -- change to a different directory first
   local D = io.popen('cd "My HD/Users/my-user/Downloads/temp"')
   local D = io.popen('ls')
   -- alternatively chain the commands together
   local D = io.popen('cd "My HD/Users/my-user/Downloads/temp" ; ls')
   local R = D:read('*a')
Description
Execute programs and batch files, you can also load results from a directory listing etc.