I want to start a command in command prompt, but os.system() can only do one command, and I want it to start from a url.
Example:
import os,getpass
print "Altline (C) James Lu"
print "All rights reserverd."
def currentuser():
try:
return "Users/" + getpass.getuser()
except:
print "Cannot detect user, starting from drive."
return ""
try:
os.path.isdir("C:/")
except:
p = raw_input("C drive does not exist, please input drive:")+":/"+ currentuser()
else:
p = "C:/" + currentuser()
while True:
prompt = p+">"
c = raw_input(prompt)
if c.startswith("to"):
u = c.lstrip("to ")
if os.path.exists(os.path.join(p,u)):
p = os.path.realpath(os.path.join(p,u))
else:
print "No such directory/file"
elif c.startswith("goto"):
if os.path.exists(u):
p = os.path.realpath(u)
else:
print "No such directory/file"
else:
print os.system(c)
Note: I am doing this because there is something crazy wrong with starting it, so you can't just start it up directly.