-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDownload_and_Install_Java
More file actions
42 lines (35 loc) · 1.04 KB
/
Copy pathDownload_and_Install_Java
File metadata and controls
42 lines (35 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$sourcex86 = 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=95501' #Java 8 u 25 x86
$sourcex64 = 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=111689' #Java 8 u 25 x64
$64bit = $false
if(Test-Path 'C:\Program Files (x86)' -PathType Container){
$64bit = $true
}
try{
if(Test-Path 'C:\Download\Java' -PathType Container){
$destinationx86 ='C:\Download\Java\java7u25x86.exe'
if($64bit){
$destinationx64 ='C:\Download\Java\java7u25x64.exe'
}
}
else{
New-Item -Path 'C:\Download' -Name 'Java' -ItemType directory
$destinationx86 ='C:\Download\Java\java7u25x86.exe'
if($64bit){
$destinationx64 ='C:\Download\Java\java7u25x64.exe'
}
}
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($sourcex86, $destinationx86)
if($64bit){
$wc.DownloadFile($sourcex64, $destinationx64)
}
}
catch{
$Error[0]
return (-1)
}
CMD /c $destinationx86 /s
if($64bit){
CMD /c $destinationx64 /s
}
Write-Output Task Completed