i want to run my bat file with wine. all went well, but when using crontab it did not work

this is my script in crontab

02 21 * * * wine cmd.exe /C /python/newstart.bat

How do you make it work?

  • Where is wine located and what is your $PATH within the crontab? If Wine needs to open a window, there will be further complications (see e.g. unix.stackexchange.com/questions/10121).
    – Kusalananda
    Apr 17, 2020 at 14:38
  • wine does not need to open a new window, because wine only runs the python syntax. the wine location is at /root/.wine
    – R ford
    Apr 17, 2020 at 14:45
  • You mean the wine executable is /root/.wine or /root/.wine/wine? Check with command -v wine. What user's crontab are you using? If it's not root, does the user have access to the wine executable?
    – Kusalananda
    Apr 17, 2020 at 14:48
  • if i check use command -v wine wine location in /usr/bin/wine. i'm using root to execut wine. Wine run smoothly, sir, if i runwine cmd.exe /C /python/newstart.bat
    – R ford
    Apr 17, 2020 at 14:52

2 Answers 2


I have tried to run scripts with wine commands in them. I have managed to get the scripts to run in SSH and in the server console. I have been completely unable to get the scripts to run via cron. It appears that wine commands cannot be run using cron.

The problem is that cron doesn't allow access to the desktop gui, xauth and display, which wine requires. There are (complicated and kludgy) ways of setting that up so you can run wine applications through SSH, but apparently not through cron.

There are ways, other than cron, of having commands run at specific times, such as the "at" command, where wine commands might not fail but you would still have to jump through a lot of hoops. I used a combination of Lutris, gtk-launch and screen to do the trick.


@Kusalananda comment is right and helped me. In cron you need to use the full path also for commands, like for grep I'am using /usr/bin/pgrep And for wine you can check with command -v wine Mine was at /usr/local/bin/wine, just replace wine with the full path

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .