On Fri, 16 Aug 2002, Hal E. Fulton wrote: > > My solution: > > Write a C program that will detect its own name and > directory; [...] > > Note that you only have to compile once, since the > program knows its own name. You can just > copy fakeruby.exe myprog.exe > assuming there is a myprog.rb in that directory. > I have used almost exactly the same solution for Perl on Windows for several years. It has worked quite well. The only tricky thing I know of for this to work, is that you may have to "compensate" for the way arguments are passed between processes on Windows (this is only a problem for arguments with spaces, or other "funny" characters (I could write long article just about these differences between Windows and UNIX ;-) )) This solution is the best I've found so far. It works in *all* situations (as far as I know). Much better than BAT-file-wrappers, or extension-associations if you want things to work: - in different "shells", and not just in CMD.EXE but also for example tcsh, bash and ksh - from other applications like Visual Studio (eg. the Tool menu) - on different flavors of Windows (Windows9x, NT4, Windows2000, XP ...) > > Feel free to criticize it or improve it. It's far > from perfect. For some reason, execvp() didn't work > for me. > [...] > > system(sysstr); > I used "CreateProcess" instead of "system" (or "execvp"). Since we are trying to make things work correctly on Windows, I felt that it was better to use the native API, to get better control of what is done. /Johan Holmberg