Mar-29-2021, 11:31 PM
Hi there! Got code! Down here |
import os print("mini command line v1.0.0") print("type help for a list of commands.") print("") def commandline(): commandline = input("C:\\system\\commands>") return commandline commands = ["help", "dir", "exit"] commandline_string = "" while commandline_string != "exit": commandline_string = commandline() if not commandline_string in commands and commandline_string != "": print("Unable to run command. Please check that the command exists and that you have permission to use it.") if commandline_string == "help": print("These are the valid commands") for command in commands: print(command) elif commandline_string == "dir": files = os.listdir("/") for file in files: print(file) elif commandline_string == "dir /?": print("the dir command will display your computer directories.") elif commandline_string == "exit /?": print("the exit command will exit the XC command line command interpreter.")That is the code for a mini command line. I did not know how to add files so...