That should work just fine, but since you will have both Program Files
and Program Files (x86)
on 64 bit installations this will always expand to Program Files
which might be wrong in your case.
I would use the following to dynamically determine the correct path:
look_for='My Program/myprogram.exe'
for dir in "$HOME"/.wine/drive_c/[Pp]rogram*[Ff]*/; do
if [ -e "${dir}${look_for}" ]; then
cd "${dir}"
wine [...]
exit $?
fi
done
This loops over all possible "program files" directories and checks if the file/directory specified in $look_for
exists underneath it. If it does, it takes the directory component of $look_for
, cd
s into it and runs wine
from there.