SoFunction
Updated on 2025-03-10

VBS script implements code instances that download jre package and install silently

After the installation is completed, you can call back and replace echo 123456789 and pause.

dim path
set ws = CreateObject("")
set fso=createobject("")
''Define the installation path
path = ("%windir%")+"\jre6\"
''Create a directory
If ((path)) Then
Else
  (path)
End If
''File download
Set xPost = CreateObject("")
Set sGet = CreateObject("")
Sub DownloadToFile(url, file)
  "GET", url, False
 
  = 1
 
  
  file, 2
 
End Sub
dim url
url = "/"
dim fileName,batpath
fileName = path+Right(url, Len(url) - InStrRev(url,"/"))
DownloadToFile url, fileName
batpath = path+""
set f=(batpath)
''WritebatPerform the installationjre,Output after completion123456789,And pause
 fileName+" /s INSTALLDIR="+path& vbcrlf&"echo 123456789"&vbcrlf&"pause"

''Hide run
(batpath),0,true