1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

mingw setup

Posted at
@echo off

set repo_owner=niXman
set repo_name=mingw-builds-binaries
set unzip_path=C:
set url=https://www.7-zip.org/a/7z2201.exe
set installer_file=7z2201.exe

set "SEVENZIP_EXE=C:\Program Files (x86)\7-Zip\7z.exe"
if not exist "%SEVENZIP_EXE%" (
  echo 7zip is not installed, downloading installer...
  curl -L -o %installer_file% %url%
  echo Installing 7zip...
  start /wait %installer_file%
)

echo Retrieving latest release information...
for /f "usebackq tokens=2 delims== " %%G in (`curl -s https://api.github.com/repos/%repo_owner%/%repo_name%/releases/latest ^| findstr "browser_download_url"`) do set url=%%~G

if not exist "%unzip_path%" mkdir "%unzip_path%"

for /f "tokens=*" %%F in ("%url%") do set zip_file=%%~nxF

if not exist "%zip_file%" (
  echo Downloading %zip_file%...
  curl -L -o %zip_file% %url%
)

echo Extracting files to %unzip_path%...
"%SEVENZIP_EXE%" x "%zip_file%" -o"%unzip_path%"

echo %unzip_path%\mingw64\bin
setx PATH "%unzip_path%\mingw64\bin;%PATH%" /M

echo Done!
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?