Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shell
#2
Perhaps these examples may help you ....

Example 1
Code:
' system
' ------

' 'system cmd' executes a system command.
system "dir"

' This executes the system command 'pause', which waits for the user to press any key.
system "pause"

' Clear the console window
system "cls"

' If called in an expression, 'system' returns the output of the command instead of printing it
' to the console window.
result = system("dir")

' Print the first line.
pln "First line: " + split(result, chr(10))[0]
pln

system "pause"


Example 2
Code:
' 'system' works as in n6, but can also be used in an expression to capture the
' output instead of sending it to stdout.

' This probably doesn't work on Linux.
result = system("dir /b /a-d")
pln "Press enter to see the captured result!"
a = rln()
pln result

pln "Press enter to see it again!"
a = rln()
system "dir /b /a-d"

pln
pln "Press enter to exit"
tmp = rln()

Example 3 [ Edited ]
unzip [starwars.zip] and compile [starwars.n7]

Example 4
unzip [Shell.zip] and compile [game.n7]


Attached Files
.zip   Shell.zip (Size: 1.7 KB / Downloads: 2)
.zip   starwars.zip (Size: 2.06 KB / Downloads: 1)
Reply


Messages In This Thread
Shell - by johnno56 - 03-29-2025, 05:18 AM
RE: Shell - by 1micha.elok - 03-29-2025, 07:12 AM
RE: Shell - by Marcus - 03-29-2025, 07:54 AM
RE: Shell - by johnno56 - 03-29-2025, 08:11 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)