I am trying to make a script which would run an .exe file from my computer. I think I am using the wrong command. I tried all the other commands like import os, os.startfile, but they aren’t working.
Here is my code:
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
You can use os.system() like so (note: it is usually better to use
subprocessfor doing things like this):Changed a few other minor things in the code like checking an int against another int (instead of string against an int), etc.