@@ -139,7 +139,16 @@ if not exist "%otp_dir%\bin" (
139
139
curl.exe -fsSLo %tmp_dir% \%otp_zip% " !otp_url! " || exit /b 1
140
140
141
141
echo unpacking %tmp_dir% \%otp_zip%
142
- powershell -Command " Expand-Archive -LiteralPath %tmp_dir% \%otp_zip% -DestinationPath %otp_dir% "
142
+ powershell -NoProfile -Command ^
143
+ " $ErrorActionPreference='Stop';" ^
144
+ " try {" ^
145
+ " if (-not (Get-Command Expand-Archive -ErrorAction SilentlyContinue)) {" ^
146
+ " Add-Type -AssemblyName System.IO.Compression.FileSystem;" ^
147
+ " [System.IO.Compression.ZipFile]::ExtractToDirectory('%tmp_dir% \%otp_zip% ', '%otp_dir% ')" ^
148
+ " } else {" ^
149
+ " Expand-Archive -LiteralPath '%tmp_dir% \%otp_zip% ' -DestinationPath '%otp_dir% ' -Force" ^
150
+ " }" ^
151
+ " } catch { Write-Error $_; exit 1 }"
143
152
del /f /q " %tmp_dir% \%otp_zip% "
144
153
cd /d " %otp_dir% "
145
154
@@ -166,7 +175,16 @@ if not exist "%elixir_dir%\bin" (
166
175
curl.exe -fsSLo " %tmp_dir% \%elixir_zip% " " !elixir_url! " || exit /b 1
167
176
168
177
echo unpacking %tmp_dir% \%elixir_zip%
169
- powershell -Command " Expand-Archive -LiteralPath %tmp_dir% \%elixir_zip% -DestinationPath %elixir_dir% "
178
+ powershell -NoProfile -Command ^
179
+ " $ErrorActionPreference='Stop';" ^
180
+ " try {" ^
181
+ " if (-not (Get-Command Expand-Archive -ErrorAction SilentlyContinue)) {" ^
182
+ " Add-Type -AssemblyName System.IO.Compression.FileSystem;" ^
183
+ " [System.IO.Compression.ZipFile]::ExtractToDirectory('%tmp_dir% \%elixir_zip% ', '%elixir_dir% ')" ^
184
+ " } else {" ^
185
+ " Expand-Archive -LiteralPath '%tmp_dir% \%elixir_zip% ' -DestinationPath '%elixir_dir% ' -Force" ^
186
+ " }" ^
187
+ " } catch { Write-Error $_; exit 1 }"
170
188
del /f /q %tmp_dir% \%elixir_zip%
171
189
)
172
190
goto :eof
0 commit comments