@echo off
@C:\Windows\System32\chcp 28591 > nul
@C:\Windows\System32\mode con cols=101 lines=20
@Title Exécution en Mode ADMIN 
:: On execute les commandes en administateur
::------------------------------------------
REM --> Verification des permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> Erreur vous ne possedez pas les droits admin
if '%errorlevel%' NEQ '0' (
REM --> Verification des privileges administrateur
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
@echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"="
echo UAC.ShellExecute "%~s0", "%params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
@cls
::------------------------------------------
:: supprime les anciens raccourcis
CD /D "C:\Users\Public\Desktop\"
del "By Click Downloader*.lnk" >nul 2>&1
del "ByClickDownloader.exe*.lnk" >nul 2>&1 
del "ByClickDownloaderPortable.exe*.lnk" >nul 2>&1
::----
CD /D "C:\Users\%username%\Desktop\"
del "By Click Downloader*.lnk" >nul 2>&1
del "ByClickDownloader.exe*.lnk" >nul 2>&1
del "ByClickDownloaderPortable.exe*.lnk" >nul 2>&1
::------------------------------------------
echo Set oWS = WScript.CreateObject("WScript.Shell") >>lnk.vbs 
:: Chemin du raccourci
echo sLinkFile = "C:\Users\Public\Desktop\By Click Downloader v2.4.28_Portable.lnk" >>lnk.vbs 
:: creation du raccourci
echo Set oLink = oWS.CreateShortcut(sLinkFile) >>lnk.vbs 
:: definition du lien
echo oLink.TargetPath = "%~dp0\By Click Downloader v2.4.28_Portable\ByClickDownloaderPortable.exe" >>lnk.vbs
:: Chemin de l'icône
echo oLink.IconLocation = "%~dp0\By Click Downloader v2.4.28_Portable\ByClickDownloaderPortable.exe" >>lnk.vbs 
:: definition du dossier de travail
echo oLink.WorkingDirectory = "%~dp0\By Click Downloader v2.4.28_Portable" >>lnk.vbs
:: description
echo oLink.Description = "By Click Downloader v2.4.28_Portable" >>lnk.vbs 
:: creation du raccourci suivant ce qui a ete indique auparavant
echo oLink.Save >>lnk.vbs 
:: lance le fichier
start /WAIT lnk.vbs 
:: supprime le fichier temporaire
del lnk.vbs
