How to call WINE from a bash script?

Asked by Hamish McIntyre-Bhatty

My ubuntu version is 12.04.2 LTS with the latest updates, and it is running on an emachines er1402 with a 32-bit processor and os installed. Also my wine version is: wine-1.5.31. To effectively finish a script I'm writing, all I need is to know how to correctly call wine (with a variable) from the bash script. (paths may include spaces). Thanks in advance.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu wine1.4 Edit question
Assignee:
No assignee Edit question
Solved by:
Hamish McIntyre-Bhatty
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

sudo apt-get install wine

Will install it

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2

You will need to mark the file to run with wine and run it with wine. I suggest you name the installer something without spaces, but you can escape spaces with slashes. Eg:

wine file\ name\ with\ spaces.exe

If you dual boot with Windows and want to run an installed application from the Windows OS then this will not work unless the application is portable.

Revision history for this message
Hamish McIntyre-Bhatty (hamishmb) said :
#3

Thanks for your answer. I don't dual boot with Windows. The script is designed to autorun files from a cd, so the path and mane could have any number of spaces in it. Would it be better to call it with : wine "/media/cd\ rom/exefile.exe or with:
wine Z:\media\cd/ rom\exefile.exe? How would I use the escape "\" character for this kind of syntax?

Thanks.

Revision history for this message
daniel CURTIS (anoda) said :
#4

Hi Hamish. What about Wine with a DOS or Windows style path inside single quotes? Let see:

,-----[ example ]
| wine start 'C:\Games\WoW\wow.exe'
`-----

You should use 'wine start' if you specify a full path. However, if you want Unix-style pathname, please use the '/Unix' option:

,-----[ Unix pathnames ]
| wine start /Unix "$HOME/Games/setup.exe"
`-----

Generally the most valuable info you will find here: http://wiki.winehq.org/FAQ#head-68d921c50355f280a905e3574b7dda58d76ff51f

Best regards.

Revision history for this message
Hamish McIntyre-Bhatty (hamishmb) said :
#5

Thanks for your answer. So if using unix-style paths, use them inside double quotes? Will these methods work if there are spaces in the path? What does WINE use as an escape character for DOS-style paths?

Thanks very much for your help.

Revision history for this message
daniel CURTIS (anoda) said :
#6

Hi Hamish. Sorry for a long time without response. Let see. According to FAQ it's looks like:

,-----[ unix-style and DOS style example ]
| wine start /unix /media/cdrom/setup.exe
| wine start 'D:\setup.exe'
`-----

Of course You can try to run an application e.g. without quotes etc., right? I see that You've already solved this problem. Congratulations.

Best regards.

Revision history for this message
Hamish McIntyre-Bhatty (hamishmb) said :
#7

Thanks, but no, it was your solution that worked, you just posted it as a comment so I'm unable to say that you solved it...
Anyway thanks, I didn't know you could use "wine start", but that's fixed the problem perfectly.

Thanks

Hamish

Revision history for this message
daniel CURTIS (anoda) said :
#8

Hi Hamish. I'm very glad that you manage to solve your problem. "you just posted it as a comment so I'm unable to say that you solved it..." of course you can say "thank you". There is an option called "this solved my problem" or something like that, but it does not matter. Most importantly - the problem is solved. :-)

Best regards.