When running Windows, i often had problems with long folder-names, especially on the command line.
Since Scala also has a problem with a JDK lying in a folder like “Program Files(x86)” i decided to write a little batch-helper to convert long folder names to the short 8.3-form.
Then i put the short name of my JDK folder into my environment variables, voilĂ – i don’t need to move the JDK to satisfy Scalas needs ![]()
The script works like this:
C:\>83conv C:\Program Files (x86)\Java\jdk1.6.0_20 C:\PROGRA~2\Java\JDK16~1.0_2 C:\>
The source:
@echo off
rem # Shorten long Windows pathname to 8.3 pathname
rem # e.g. C:\Program Files (x86)\Java\jdk1.6.0_20\lib --> C:\PROGRA~2\Java\JDK16~1.0_2\lib
if %1!==! goto WRONGPARAM
if NOT exist "%*" goto :NODIR
set filename="%*"
FOR /F "delims=" %%I in ('echo %filename%') do @echo %%~sI
goto :eof
:WRONGPARAM
echo Usage:
echo 83conv [PATH]
echo.
:NODIR
echo 83conv: Not a directory 1>&2
2 Comments
Hey, cool script.
Here is a similar script I use that shortens file names to upto 8 chars but keeping the extension.
var string list, file, name, ext
lf -n “*” “.” ($ftype==”f”) > $list
while ($list “”)
do
lex “1″ $list > $file
stex -p “^/^[" $file > $name
stex "[^.^l" $name > $ext
chex "8]” $name > $name
set $name = $name + $ext
system rename (“\”"+$file+”\”") (“\”"+$name+”\”")
done
This is in bscripting ( http://www.biterscripting.com ). Can do some cool funky stuff with it.
This script does not seem to work on my Windows XP Pro. The translation is incorrect:
C:\SEU\Java\weblogic-10.3.4\wl-10.3.4\wlserver
translates to
C:\SEU\Java\WEBLOG~1.4\WL-103~1.4\wlserverrver