SHOW:
|
|
- or go back to the newest paste.
| 1 | shell.run("clear")
| |
| 2 | local bExit = false | |
| 3 | ||
| 4 | function eDecode(test) | |
| 5 | local tCommandHistory = {}
| |
| 6 | test = io.open(test, "r") | |
| 7 | ||
| 8 | for sLine in test:lines() do | |
| 9 | table.insert( tCommandHistory, sLine ) | |
| 10 | ||
| 11 | local tWords = {}
| |
| 12 | for match in string.gmatch(sLine, "[^ \t]+") do | |
| 13 | table.insert( tWords, match ) | |
| 14 | end | |
| 15 | ||
| 16 | eBatch(tWords, false, sLine) | |
| 17 | end | |
| 18 | test.close() | |
| 19 | end | |
| 20 | ||
| 21 | function eBatch(tWords, test, full) | |
| 22 | local sCommand = tWords[1] | |
| 23 | if sCommand == "echo" then | |
| 24 | if tWords[2] then | |
| 25 | print(string.sub(full, 6, string.len(full))) | |
| 26 | if test == false then | |
| 27 | print() | |
| 28 | end | |
| 29 | else | |
| 30 | if test == false then | |
| 31 | print("ECHO is on.")
| |
| 32 | end | |
| 33 | end | |
| 34 | elseif sCommand == "exit" then | |
| 35 | bExit = true | |
| 36 | elseif sCommand == "cmd" then | |
| 37 | print("NeXuS Windows [Version 1.1.0001]")
| |
| 38 | print("Copyright (c) NeXuS Corporation. All rights reserved.\n")
| |
| 39 | elseif sCommand == "pause" then | |
| 40 | print("Press any key to continue.")
| |
| 41 | os.pullEvent("key")
| |
| 42 | sleep(0) | |
| 43 | elseif sCommand == "cls" then | |
| 44 | term.clear() | |
| 45 | term.setCursorPos(1,1) | |
| 46 | elseif sCommand == "dir" then | |
| 47 | shell.run("rom/programs/list")
| |
| 48 | elseif sCommand == "del" then | |
| 49 | if tWords[2] then | |
| 50 | if fs.exists(tWords[2]) then | |
| 51 | if fs.isReadOnly(tWords[2]) then | |
| 52 | print("Could Not Find C:\\Users\\Admin\\" ..tWords[2].. "\n")
| |
| 53 | else | |
| 54 | fs.delete( tWords[2] ) | |
| 55 | end | |
| 56 | else | |
| 57 | print("Could Not Find C:\\Users\\Admin\\" ..tWords[2].. "\n")
| |
| 58 | end | |
| 59 | else | |
| 60 | print("Could Not Find C:\\AppData\\Earth\\Users\\You\\Brain.exe\n")
| |
| 61 | end | |
| 62 | elseif sCommand == "execute" then --just made this one up, might not exist | |
| 63 | if tWords[2] then | |
| 64 | if fs.exists(tWords[2]) then | |
| 65 | eDecode(tWords[2]) | |
| 66 | else | |
| 67 | print("Could Not Find C:\\Users\\Admin\\" ..tWords[2])
| |
| 68 | end | |
| 69 | end | |
| 70 | elseif sCommand == "title" then | |
| 71 | return tWords[2] --Title is pretty much useless here, so i'll just return what they typed for other's programs. | |
| 72 | else | |
| 73 | print("'"..sCommand.."' is not recognized as a internal or external command, operable program or batch file. \n")
| |
| 74 | end | |
| 75 | end | |
| 76 | ||
| 77 | print("NeXuS Windows [Version 1.1.0001]")
| |
| 78 | print("Copyright (c) NeXuS Corporation. All rights reserved.\n")
| |
| 79 | ||
| 80 | local tCommandHistory = {}
| |
| 81 | while not bExit do | |
| 82 | write( "C:\\Users\\Admin> " ) | |
| 83 | ||
| 84 | local sLine = read( nil, tCommandHistory ) | |
| 85 | table.insert( tCommandHistory, sLine ) | |
| 86 | ||
| 87 | local tWords = {}
| |
| 88 | for match in string.gmatch(sLine, "[^ \t]+") do | |
| 89 | table.insert( tWords, match ) | |
| 90 | end | |
| 91 | ||
| 92 | eBatch(tWords, false, sLine) | |
| 93 | end |