[Wine]Setting default or startup directory for win32 program

Holly Bostick motub at planet.nl
Mon Oct 11 04:44:01 CDT 2004

Stefan Munz wrote:
> Am Montag, 11. Oktober 2004 03:44 schrieb Matthew L Reed:
>>I'm trying to run a program, hlds.exe, which is the windows half-life
>>server. So far, the only way to get it to start is to use the windows
>>program TotalCommander and start it from there (TotalCommander is a
>>NortonCommander clone). In TC, it shows me a C: drive, and a Z: drive,
>>where the Z: drive appears to be mapped to \
>>If I try to start it from within Konqueror, or create a link on the
>>desktop, it gives an error that basically means it's not in the correct
>>directory. Does the concept of default directory apply here? If this was
>>Windows, the problem would be that it's startup directory is wrong,
>>although I created the link in the proper directory. So, I'm thinking that
>>I just don't know how to specify the correct startup directory.
>>So, my question is, how do I start a win32 app with wine and force/specify
>>a startup directory?
> maybe not exactly what you meant but it will do the job:
> echo "cd /toMyWineDir/; wine myWinPrg.exe" > starthl.sh
> chmod 755 starthl.sh
> now you can start your app with ./starthl.sh or create a link on the desktop 
> to the script.
> cu,
> Stefan

To further explain from my own experience:

Some programs, when run under Wine, "understand" the concept of a 
startup directory, and will run fine when started from any directory 
that your terminal might be pointed to when you type wine <program.exe>. 
Many, however, don't, and when run with Wine such programs must be 
started from the directory where they live, or they won't run.

It appears to mostly be a matter of trial and error to know which kind 
of program is which, and your trial (and error) seems to indicate that 
HL Server is one of the latter kind.

For those programs, a script such as the one Stefan suggests is the best 
approach I've found, if you desire to add such program to menus, or make 
a panel shortcut to run them. You can also create a shell alias to the 
script, to minimize typing even more, if you want (echo 'alias 
hls="~/starthl.sh"' >>~/.bashrc-- you would then only have to type 'hls' 
from any directory to run the script).

Hope this helps,

More information about the wine-users mailing list