Windows bat file is location specific
A Java SQL client for any JDBC compliant database
Brought to you by:
colbell,
gerdwagner
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%
Full bat file to start the applicaiton with the above change in it.
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
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
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 \
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%
Logged In: YES
user_id=1287991
Very nice. I'll give it a try.
Rob
Logged In: YES
user_id=1287991
Fixed in CVS. Should be available in the 2.2 final release
I'm creating today.
Rob