Skip to Content
Learn Red ? Fundamentals of Red
book

Learn Red ? Fundamentals of Red

by Ivo Balbaert
May 2018
Beginner content levelBeginner
252 pages
6h 19m
English
Packt Publishing
Content preview from Learn Red ? Fundamentals of Red

Calling an external program – call

Running an external process, program, or shell script from within a Red app is easy—just use the call word. Here are some examples you can try out in the Red console:

;-- see Chapter10/interacting-os.red:call "explorer.exe" ;== 9668 (1)call/shell "notepad.exe" ;== 2292 (2)call/shell "notepad.exe info.txt" ;== 11632 (3)cmd: "notepad.exe info.txt"call/shell cmd ;== 7244 (4)call/shell/wait "notepad.exe" ;== 0 (5)call/output "ls" %listing ;== 0 (6)call "start copy nul > myfile.txt" ;== 13760 (7)

Let's break down what's happening line by line:

  1. Here, we start Windows Explorer.
  2. Notepad is started (on Windows).
  3. Here, a file info.txt will be opened in Notepad.
  4. You can store the shell command in a word.
  5. In the previous ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

How I Built a Personal Board of Directors With GenAI

How I Built a Personal Board of Directors With GenAI

Vipin Gupta
How to Become a Game-Changing Leader

How to Become a Game-Changing Leader

Douglas A. Ready, Alan Mulally
Why AI Demands a New Breed of Leaders

Why AI Demands a New Breed of Leaders

Faisal Hoque, Thomas Davenport, Erik Nelson

Publisher Resources

ISBN: 9781789130706Supplemental Content