How to run a windows .bat script with wine from command line?

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


Solution 1:

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

wine cmd.exe /C runme.bat

Solution 2:

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

Sources:

https://askubuntu.com/questions/316025/how-to-install-and-configure-wine

https://askubuntu.com/questions/54266/executing-bat-file

Solution 3:

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