I'm trying to run a batch script from my mac terminal using wine (in order to provide arguments to a windows executable and piping output).

so far I've tried executing

wine runme.bat 

but obviously I get an error that says approximately "EXE Format not correct for <... here the path of batch file ...>" (it's a localized error message, I translated it to English for the sake of clarity). So I understand I have to call the batch file using something like cmd.exe but I've no idea where to find cmd.exe.

Is there any alternative approach? (the exe called from the batch file is a windows executable without a GUI, I cannot use DosBox thus).

Thanks in advance for any suggestion :)


I don't use Wine, but the docs suggest this should work:

wine cmd.exe /C runme.bat
  • I guessed so, but I do not have cmd.exe (I mentioned that in the question, but maybe I was unclear, my English is not so good). If I run your code I get a "file not found" error. – furins Jan 28 '13 at 23:42
  • 1
    I see. Then you'll need another command processor that can accept cmd.exe syntax and can interpret that .bat file. You might try TCC/E, formerly known as 4NT. – Nicole Hamilton Jan 28 '13 at 23:49
  • looks promising! thank you, I'll try it immediately – furins Jan 28 '13 at 23:51
  • I'm unable to install it but it may depend on wine itself. Anyway, I think you put me in the right direction: Thank you! – furins Jan 29 '13 at 0:06
  • 2
    If anybody will look for an answer I've been able to run the command using the cmd.exe provided by wine (I didn't realized wine has it): /Applications/Wine.app/Contents/Resources/lib/wine/fakedlls/cmd.exe – furins Jan 29 '13 at 0:10

This solution worked for me.

First install wine :

sudo add-apt-repository ppa:ubuntu-wine/ppa -y && sudo apt-get update && sudo apt-get install wine

Then run from terminal :

wineconsole /path/to/bat_file/bat_file.bat





This works for me (macOS Sierra, wine Version 1.8.6):

start Wine (from Applications as you normally start programs)

Click the wine glass icon at the top of the screen.

Click on "File Manager" in the drop-down list.

Click the "Z:" drive button in the file manager.

navigate to the DOS batch file on and double click it

It works for me. I used this method to start a DOS program (WSPRGEN.exe) and pass arguments in the batch program. This DOS program generates a needed include program (.inc) for an amateur radio communications program

  • Thank you @pete for taking the time to answer my question. Your solution works great when you have access to the GUI so you can click on items. In my question however I needed to run the .bat from inside a script, to automate a process, so clicking on items was not an option. In any case, your answer may still be useful for other users, so here is my upvote! – furins Oct 21 '20 at 8:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.