How to run a program in python?

Posted by Luka Mihaldinec on Stack Overflow See other posts from Stack Overflow or by Luka Mihaldinec
Published on 2012-09-21T21:29:57Z Indexed on 2012/09/21 21:38 UTC
Read the original article Hit count: 212

Filed under:

this is my code. I'm trying to make a script which would run an .exe file from my computer. And this one isn't working :/ I think I'm using the wrong command.. I tried all the other commands like import os, os.startfile, but they won't work too. I think my code is just wrong :P

loop=0
while loop==0:
    answer=raw_input("coded by: Narralol\n\n"
    "Pick a task:\n"
    "1) Start Minecraft.exe\n"
    "2) Start Minecraft_Server.jar\n"
    "3) Backup your server\n"
    "4) Copy the backup to your desktop\n"
    "5) Exit\n")
    if answer==1:
        execfile('D:\Games\Minecraft\Minecraft.exe')
    elif answer==2:
        execfile('D:\Games\Minecraft\Minecraft_server.jar')
    elif answer==5:
        loop=1

© Stack Overflow or respective owner

Related posts about python