Menu

#369 Windows bat file is location specific

None
closed-fixed
5
2018-12-22
2006-04-04
No

The windows batch file to startup squirrel is location
specific. The following change makes it work from any
directory, where these lines replace the original set
SQUIRREL_SQL_HOME line in squirrel-sql.bat. I often
run squirrel from a remote machine, so not needing to
fix the bat file all the time is very helpful.

set SQUIRREL_SQL_HOME=%~f0
set SQUIRREL_SQL_HOME=%SQUIRREL_SQL_HOME:~0,-16%

Discussion

  • Bill Wallace

    Bill Wallace - 2006-04-04

    Full bat file to start the applicaiton with the above change in it.

     
  • Rob Manning

    Rob Manning - 2006-04-04
    • labels: 336290 --> Launcher Scripts
     
  • Rob Manning

    Rob Manning - 2006-04-04

    Logged In: YES
    user_id=1287991

    Wow, that certainly wins the award for most cryptic DOS
    batch syntax in my humble opinion. I never would have
    guessed there was a way to do `dir "${0}"` on windows.
    If it works I'll get it into CVS when CVS is back up.

    Rob

     
  • Rob Manning

    Rob Manning - 2006-04-06

    Logged In: YES
    user_id=1287991

    OK, I tried it and I'm not real impressed. First, whenever
    I launch squirrel by double-clicking on the batch file or
    via a shortcut in the launch toolbar, somehow the plugins are
    not being included. Secondly, if I rename the batch file
    with an underscore and try it, the SQUIRREL_SQL_HOME isn't
    properly detected. If we could somehow get the first
    problem fixed, I might consider including it. Still, if it
    depends on the name of the batch file to work properly, then
    it's a pretty fragile improvement at best.

    Rob Manning

     
  • Rob Manning

    Rob Manning - 2006-04-06
    • status: open --> pending
     
  • Bill Wallace

    Bill Wallace - 2006-04-12
    • status: pending --> open
     
  • Bill Wallace

    Bill Wallace - 2006-04-12

    Logged In: YES
    user_id=614981

    To fix the loading of the plugins, change the -16 to a -17
    in order to exclude the final \ in the path as well as the
    bat name.
    I haven't yet figured out how to make it independent of the
    name of the batch file (actually, it is independent of the
    name, just not independent of the LENGTH). I expect a loop
    with an if condition in it that excludes 1 character at a
    time would work, and then break when the character excluded
    is a \

     
  • Bill Wallace

    Bill Wallace - 2006-04-12
    • status: open --> pending
     
  • Bill Wallace

    Bill Wallace - 2006-04-12

    Logged In: YES
    user_id=614981

    Here is a version of the relevant portion of the script that
    is length independent:

    set basedir=%~f0
    :strip
    set removed=%basedir:~-1%
    set basedir=%basedir:~0,-1%
    if NOT "%removed%"=="\" goto strip
    set SQUIRREL_SQL_HOME=%basedir%

     
  • Rob Manning

    Rob Manning - 2006-04-12
    • status: pending --> open
     
  • Rob Manning

    Rob Manning - 2006-04-12

    Logged In: YES
    user_id=1287991

    Very nice. I'll give it a try.

    Rob

     
  • Rob Manning

    Rob Manning - 2006-04-15
    • status: open --> closed-fixed
     
  • Rob Manning

    Rob Manning - 2006-04-15

    Logged In: YES
    user_id=1287991

    Fixed in CVS. Should be available in the 2.2 final release
    I'm creating today.

    Rob

     

Log in to post a comment.