Angus Leeming <[EMAIL PROTECTED]> writes: > > Helge Hafting wrote: > >>>This should work for win98: > >>> <at> echo off > >>>if "%LANG%"=="" SET LANG=fr_FR > >>>"C:\Program Files\LyX\bin\lyx.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9 > >>> > >>Excellent! > >>And is the existing .bat file OK on more modern Windows versions? > >> > >> <at> echo off > >>if "%LANG%"=="" SET LANG=fr_FR > >>"C:\Program Files\LyX\bin\lyx.exe" %~1 %~2 %~3 %~4 %~5 %~6 %~7 %~8 %~9 > >> > > This seems fine to me, it works well on XP at least. > > I have no idea what surprises other versions might have in store. > > Testing will tell. :-/ > > Ok, then I'll use this code snippet to output the batch file: > > std::string const arg_list = is_Win2000_or_later() ? > "%~1 %~2 %~3 %~4 %~5 %~6 %~7 %~8 %~9" : > "%1 %2 %3 %4 %5 %6 %7 %8 %9";
Angus, I suggest that you simply use "%1 %2 %3 %4 %5 %6 %7 %8 %9" on all windows versions as %~1 unquotes the argument if it was quoted and this leads to problems if spaces are present (this is also true for reLyX.bat). Another problem with lyx.bat is the command window which remains open. I tried this modification: @echo off if "%LANG%"=="" SET LANG=en_EN start "C:\Programmi\LyX\bin\lyx.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9 and windows went mad, continuosly open and closing a cmd window. I had to ctrl-alt-del to regain control. However, this worked: @echo off if "%LANG%"=="" SET LANG=en_EN start C:\Programmi\LyX\bin\lyx.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 and the cmd window closed after lyx started. Note the unquoted path to the executable (now I understand what you meant about problems quoting the path to executables). I thought that to take into account spaces in the path this script could be used: @echo off if "%LANG%"=="" SET LANG=en_EN set PATH=C:\Programmi\LyX\bin;%PATH% start lyx.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 but then the cmd window remains open! To complete the strangeness, this worked again: @echo off if "%LANG%"=="" SET LANG=en_EN start lyx.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 and the cmd window closes after lyx is started. But I do not have lyx.exe in the path! I wish that someone more knowledgeable than me could explain this behavior. Wait a moment... it could be the registry... "start" somehow finds lyx.exe in the registry, perhaps. Enrico (quite confused)