Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- REM Encodage: Europe occidentale / OEM 863 : francais -> finalement abandon des accents
- REM Objet : Installatiqon de PDFCreator en un seul batch
- REM licence : BSD (Borlet Software Distribution and is like real BSD)
- REM (c) Emmanuel Borlet 2016
- REM
- REM Pour generer le fichier pdfcreator.inf executer, et faire l'install... :
- REM PDFCreator-2_3_2-Setup.exe /SAVEINF="pdfcreator.inf"
- REM s'assurer qu'il y ai dans le fichier
- REM Toolbar=0
- REM Offer=0
- REM TODO verifier la version en cours par rapport a celle disponible
- REM on telechargera dans le dossier courant du script
- REM test si droit admin
- net session >nul 2>&1
- if %errorLevel% == 0 (
- goto :start
- ) else (
- echo Il faut etre membre du groupe admin.
- echo Aucune installation n'a ete faite.
- pause
- goto :EOF
- )
- :start
- set curdir=%CD%
- cd %curdir%
- REM url ou on peut telecharger la derniere version
- set urldownload=http://download.pdfforge.org/download/pdfcreator/PDFCreator-stable?download
- echo Telechargement automatique de PDFCreator ?
- echo depuis : %urldownload%
- pause
- echo Telechargement en cours patienter...
- REM l'astuce pour passer la variable...
- powershell -Command "Set-Variable -name url -value %urldownload% ; (New-Object Net.WebClient).DownloadFile($url, 'PDFCreator-last-Setup.exe')"
- if %ERRORLEVEL% == 0 goto :install
- echo Erreur lors du telechargement, code d'erreur : %errorlevel%
- pause
- EXIT /B %ERRORLEVEL%
- :install
- echo Installation automatique de PDFCreator ?
- echo Depuis : %curdir%\PDFCreator-last-Setup.exe
- pause
- REM heredoc a 2 bales
- echo [Setup]^
- Lang=French^
- Dir=C:\Program Files\PDFCreator^
- Group=PDFCreator^
- NoIcons=0^
- SetupType=custom^
- Components=program^
- Tasks=desktopicon,desktopicon\common,winexplorer^
- Printername=PDFCreator^
- Toolbar=0^
- Offer=0^
- > pdfcreator.heredoc.inf
- start /wait %curdir%\PDFCreator-last-Setup.exe /LOADINF="pdfcreator.heredoc.inf" /SILENT /norestart
- if %ERRORLEVEL% == 0 goto :fin
- REM code d'erreur -100 a l'installation signifie OK apres une installation par desssu
- if %ERRORLEVEL% == -100 goto :fin
- echo Erreur lors de l'installation, code d'erreur : %errorlevel%
- pause
- EXIT /B %ERRORLEVEL%
- :fin
- echo C'est termine, tout est OK
- pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement