OSDN Git Service

Improve plugin system (#797)
[winmerge-jp/winmerge-jp.git] / Plugins / Commands / q / q.bat
1 @echo off
2 set DOWNLOAD_URL=https://github.com/harelba/q/releases/download/2.0.19/q-AMD64-Windows.exe
3 set Q_PATH=WinMerge\Commands\q\q-AMD64-Windows.exe
4 set MESSAGE='q command is not installed. Do you want to download it from %DOWNLOAD_URL%?'
5 set TITLE='CSV/TSV Data Querier Plugin'
6
7 cd "%APPDATA%"
8 if not exist %Q_PATH% (
9   for %%i in (%Q_PATH%) do mkdir %%~pi 2> NUL
10   powershell "if ((New-Object -com WScript.Shell).Popup(%MESSAGE%,0,%TITLE%,1) -ne 1) { throw }" > NUL
11   if errorlevel 1 (
12     echo "download is canceled" 1>&2
13   ) else (
14     start "Downloading..." /WAIT powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest %DOWNLOAD_URL% -Outfile %Q_PATH%"
15   )
16 )
17 %Q_PATH% %*