Advertisement
LogicDaemon

Total Commander autoupdate.cmd

Nov 27th, 2017
188
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @(REM coding:CP866
  2. REM by LogicDaemon <www.logicdaemon.ru>
  3. REM This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License <http://creativecommons.org/licenses/by-sa/4.0/deed.ru>.
  4. SETLOCAL ENABLEEXTENSIONS
  5. IF "%~dp0"=="" (SET "srcpath=%CD%\") ELSE SET "srcpath=%~dp0"
  6. IF NOT DEFINED PROGRAMDATA SET "PROGRAMDATA=%ALLUSERSPROFILE%\Application Data"
  7. IF NOT DEFINED APPDATA IF EXIST "%USERPROFILE%\Application Data" SET "APPDATA=%USERPROFILE%\Application Data"
  8.    
  9.     SET "dirData=%~dp0"
  10.     SET "dirDist=%~dp0"
  11.     SET "dirDlTmp=%~dp0temp\"
  12.     SET "installOptns=/A1H0L1M0G0D0U1K0" & REM https://www.ghisler.ch/wiki/index.php?title=How_to_make_installation_fully_automatic%3F
  13.     SET "dlcmdPrefix=curl.exe -OJLR"
  14.     SET "dlcmdSuffix= || EXIT /B"
  15.    
  16.     FOR /F "usebackq skip=3" %%A IN (`"%SystemRoot%\System32\nslookup.exe -type=txt releaseversion.ghisler.com"`) DO IF NOT "%%~A"=="" SET "newtcver=%%~A"
  17.     IF NOT DEFINED newtcver EXIT /B 1
  18.     FOR /F "usebackq delims=" %%A IN ("%dirData%oldver.txt") DO SET "oldtcver=%%~A"
  19. )
  20. (
  21.     IF "%newtcver%"=="%oldtcver%" EXIT /B 0
  22.     (ECHO %newtcver%)>"%dirData%newver.txt"
  23.    
  24.     FOR /F "delims=.; tokens=1,2,3,4,5" %%A IN ("%newtcver%") DO (
  25.     SET "verComponent1=%%~A"
  26.     SET "verComponent2=%%~B"
  27.     SET "verComponent3=%%~C"
  28.     SET "verComponent4=%%~D"
  29.     SET "verComponent5=%%~E"
  30.     )
  31. )
  32. (
  33.     MKDIR "%dirDlTmp%"
  34.     rem %dlcmdPrefix% http://totalcommander.ch/win/tcmd%verComponent2%%verComponent3%x32.exe %dlcmdSuffix%
  35.     rem %dlcmdPrefix% http://totalcommander.ch/win/tcmd%verComponent2%%verComponent3%x64.exe %dlcmdSuffix%
  36.     START "" /B /WAIT /D "%dirDlTmp%" %dlcmdPrefix% http://totalcommander.ch/win/tcmd%verComponent2%%verComponent3%x32_64.exe %dlcmdSuffix%
  37.     FOR %%A IN ("%dirDlTmp%\*.*") DO (
  38.     MOVE /Y "%%~A" "%dirDist%"
  39.     "%dirDist%\%%~nxA" %installOptns%
  40.     )
  41.    
  42.     MOVE "%dirData%newver.txt" "%dirData%oldver.txt"
  43.     EXIT /B
  44. )
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement