Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bExit = false
- function eDecode(test)
- local tCommandHistory = {}
- test = io.open(test, "r")
- for sLine in test:lines() do
- table.insert( tCommandHistory, sLine )
- local tWords = {}
- for match in string.gmatch(sLine, "[^ \t]+") do
- table.insert( tWords, match )
- end
- eBatch(tWords, false, sLine)
- end
- test.close()
- end
- function eBatch(tWords, test, full)
- local sCommand = tWords[1]
- if sCommand == "echo" then
- if tWords[2] then
- print(string.sub(full, 6, string.len(full)))
- if test == false then
- print()
- end
- else
- if test == false then
- print("ECHO is on.")
- end
- end
- elseif sCommand == "exit" then
- bExit = true
- elseif sCommand == "cmd" then
- print("NeXuS Windows [Version 1.1.0001]")
- print("Copyright (c) NeXuS Corporation. All rights reserved.\n")
- elseif sCommand == "pause" then
- print("Press any key to continue.")
- os.pullEvent("key")
- sleep(0)
- elseif sCommand == "cls" then
- term.clear()
- term.setCursorPos(1,1)
- elseif sCommand == "dir" then
- shell.run("rom/programs/list")
- elseif sCommand == "del" then
- if tWords[2] then
- if fs.exists(tWords[2]) then
- if fs.isReadOnly(tWords[2]) then
- print("Could Not Find C:\\Users\\Admin\\" ..tWords[2].. "\n")
- else
- fs.delete( tWords[2] )
- end
- else
- print("Could Not Find C:\\Users\\Admin\\" ..tWords[2].. "\n")
- end
- else
- print("Could Not Find C:\\AppData\\Earth\\Users\\You\\Brain.exe\n")
- end
- elseif sCommand == "execute" then --just made this one up, might not exist
- if tWords[2] then
- if fs.exists(tWords[2]) then
- eDecode(tWords[2])
- else
- print("Could Not Find C:\\Users\\Admin\\" ..tWords[2])
- end
- end
- elseif sCommand == "title" then
- return tWords[2] --Title is pretty much useless here, so i'll just return what they typed for other's programs.
- else
- print("'"..sCommand.."' is not recognized as a internal or external command, operable program or batch file. \n")
- end
- end
- print("NeXuS Windows [Version 1.1.0001]")
- print("Copyright (c) NeXuS Corporation. All rights reserved.\n")
- local tCommandHistory = {}
- while not bExit do
- write( "C:\\Users\\Admin> " )
- local sLine = read( nil, tCommandHistory )
- table.insert( tCommandHistory, sLine )
- local tWords = {}
- for match in string.gmatch(sLine, "[^ \t]+") do
- table.insert( tWords, match )
- end
- eBatch(tWords, false, sLine)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement