Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 :)

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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

wine cmd.exe /C runme.bat
share|improve this answer
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
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
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

But what is if you'll need to execute a file with the application?

This works:

 exec('wine cmd.exe /C test.exe')

This does not work:

 exec('wine cmd.exe /C test.exe test.png')
share|improve this answer
Welcome on Stack Overflow! In order to not be downvoted, you should create a new question, or eventually you should add a comment - this is not an "answer" –  furins Jan 17 at 12:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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