-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_gplk.ps1
38 lines (28 loc) · 1.25 KB
/
install_gplk.ps1
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
# Set proper execution policy
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# Define the URL of the file to download
$sourceUrl = "https://github.com/pmaldona/pyRN/raw/main/glpk-4.65.zip"
# Define the temporary location to store the downloaded file and the
extraction folder
$tempLocation = "$env:TEMP\glpk-4.65.zip"
$extractedFolder = "$env:TEMP\glpk-4.65"
# Define the destination system folder
$systemFolder = "${env:SystemRoot}\System32"
# Download the file
Invoke-WebRequest -Uri $sourceUrl -OutFile $tempLocation
# Extract the contents of the zip file
Expand-Archive -Path $tempLocation -DestinationPath $extractedFolder
# Copy the files from the w64 folder to the system folder
$sourceFiles = Get-ChildItem -Path "$extractedFolder\w64" -Recurse
$sourceFiles | ForEach-Object {
$destinationPath = Join-Path $systemFolder
$_.FullName.Substring($extractedFolder.Length + 4)
Write-Output $destinationPath
# Copy-Item -Path $_.FullName -Destination $destinationPath
-Force
Copy-Item -Path $_.FullName -Destination $systemFolder -Force
}
# Clean up - delete the temporary files and folder
Remove-Item $tempLocation -Force
Remove-Item $extractedFolder -Recurse -Force
Write-Host "glpk-4.65 files copied to the system folder."