Im trying to create a bat file to make an unattended installation with sccm. I downloaded jre-7u55-windows-i586.exe from http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html (jre-7u55-windows-i586 is used for legacy application we are running)

and followed https://www.java.com/en/download/help/silent_install.xml and could come in to

"%~dp0jre-7u55-windows-i586.exe" /s /v"AgreeToLicense=YES INSTALLDIR=C:\Program Files\test\test1\Java\jre1.7.0.55 IEXPLORER=1 MOZILLA=1 REBOOT=SUPRESS JAVAUPDATE=0 SYSTRAY=0"

Above script will work only if the installation directory is other than C:\Program Files\

For example it will work if



But I want INSTALLDIR to be

C:\Program Files\test\test1\Java\jre1.7.0.55

I tried adding following

INSTALLDIR="C:\Program Files\test\test1\Java\jre1.7.0.55" --- not working

INSTALLDIR='C:\Program Files\test\test1\Java\jre1.7.0.55' --- not working

/INSTALLDIR=C:\Program Files\test\test1\Java\jre1.7.0.55 --- not working

"INSTALLDIR=C:\Program Files\test\test1\Java\jre1.7.0.55" --- not working

All the time im getting this .. (Sounds rather misleading message)

enter image description here

I cant understand why i cant install it on C:\Program Files\test\test1\Java\jre1.7.0.55.. What Im missing here? What is wrong with C:\Program Files\test\test1\Java\jre1.7.0.55 . Pls help

(I do have admin rights for my account)

  • Not a fix, but a workaround might be to use the old 8.3 short name, eg. C:\Program Files is usually C:\Progra~1. These short names can be seen with dir /x from a command prompt. It also might help narrow down that it's a path issue, not a permissions issue. – DarkMoon Mar 8 '16 at 6:53
  • try using the %programfiles% environment variable, maybe this is a case of 32 vs 64 bits trouble. The 32 bits will not see the same program files path as the 64 bits one. – natxo asenjo Mar 8 '16 at 7:33
  • already tried this one %programfiles% .. no luck – user879 Mar 8 '16 at 8:10

You can derive the short names from the full path to overcome the limits mentioned in your question.

REM Insert full path to executable here as a literal string or environment
Call :s_Install_Short "C:\Program Files\test\test1\Java\jre1.7.0.55"
Goto :EOF

REM Block attempts to pass no parameter
If "%~1" EQU "" Goto :EOF

REM %~s1 contains the path in the first parameter as a shortened string
"%~dp0jre-7u55-windows-i586.exe" /s /v"AgreeToLicense=YES INSTALLDIR=%~s1 IEXPLORER=1 MOZILLA=1 REBOOT=SUPRESS JAVAUPDATE=0 SYSTRAY=0"

Goto :EOF

The use of %~s1 would turn C:\Program Files\test\test1\Java\jre1.7.0.55 into something similar to C:\PROGRA~1\test\test1\Java\jre1.7.0.55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.