Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
166 lines (121 sloc) 3.8 KB
@echo OFF
GOTO EndComment
FileBot Advanced Context Menu v1.8 (Live Installer)
Written by CapriciousSage (Ithiel) with assistance from rednoah (Reinhard Pointner)
Requires Windows 7 or higher.
This file requires Administrative Privileges
FileBot written by rednoah (Reinhard Pointner)
FileBot: http://www.filebot.net
Help Support FileBot!
Please Donate via PayPal: http://www.filebot.net/donate.html
No warranty given or implied, use at your own risk.
Last Updated: 24/02/2014
:EndComment
:ADMIN-CHECK
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
GOTO DirCheck1
) else ( GOTO gotAdmin )
:DirCheck1
copy /Y NUL "%~dp0\.writable" > NUL 2>&1 && set WRITEOK=1
IF DEFINED WRITEOK (
del "%~dp0\.writable"
GOTO UACPrompt1
) else (
echo Checking profile instead...
GOTO DirCheck2
)
:DirCheck2
copy /Y NUL "%USERPROFILE%\.writable" > NUL 2>&1 && set WRITEOK=1
IF DEFINED WRITEOK (
del "%USERPROFILE%\.writable"
GOTO UACPrompt2
) else (
echo Checking temp instead...
GOTO DirCheck3
)
:DirCheck3
copy /Y NUL "%tmp%\.writable" > NUL 2>&1 && set WRITEOK=1
IF DEFINED WRITEOK (
del "%tmp%\.writable"
GOTO UACPrompt3
) else (
GOTO UACFailed
)
:UACPrompt1
echo Set UAC = CreateObject^("Shell.Application"^) > "%~dp0\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%~dp0\getadmin.vbs"
"%~dp0\getadmin.vbs"
if '%errorlevel%' NEQ '0' (
del "%~dp0\getadmin.vbs"
GOTO DirCheck2
) else ( GOTO UACPrompt1Complete )
:UACPrompt1Complete
del "%~dp0\getadmin.vbs"
exit /b
GOTO gotAdmin
:UACPrompt2
echo Set UAC = CreateObject^("Shell.Application"^) > "%USERPROFILE%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%USERPROFILE%\getadmin.vbs"
"%USERPROFILE%\getadmin.vbs"
if '%errorlevel%' NEQ '0' (
del "%USERPROFILE%\getadmin.vbs"
GOTO DirCheck3
) else ( GOTO UACPrompt2Complete )
:UACPrompt2Complete
del "%USERPROFILE%\getadmin.vbs"
exit /b
GOTO gotAdmin
:UACPrompt3
echo Set UAC = CreateObject^("Shell.Application"^) > "%tmp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%tmp%\getadmin.vbs"
"%tmp%\getadmin.vbs"
if '%errorlevel%' NEQ '0' (
del "%tmp%\getadmin.vbs"
GOTO UACFailed
) else ( GOTO UACPrompt3Complete )
:UACPrompt3Complete
del "%tmp%\getadmin.vbs"
exit /b
GOTO gotAdmin
:UACFailed
echo Upgrading to admin privliages failed.
echo Please right click the file and run as administrator.
echo PAUSE
GOTO FINISH
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
GOTO CALL-SETUP
:CALL-SETUP
set logfile="%tmp%\filebot_context_menu_setup_log.txt"
echo Downloading Latest Setup File >> %logfile%
bitsadmin.exe /transfer "Download_Install" /priority foreground "https://github.com/CapriciousSage/cmdlets/raw/master/context_menu_setup.cmd" "%~dp0\context_menu_setup.cmd"
echo Running Setup File >> %logfile%
call "%~dp0\context_menu_setup.cmd"
echo Deleting Temporary Setup File >> %logfile%
del "%~dp0\context_menu_setup.cmd"
if not errorlevel 0 GOTO ERR1
echo Cloud Managed Install Complete >> %logfile%
GOTO ALLOK
:ERR1
echo **** Warning: Something Didn't Work. Please Confirm Settings **** >> %logfile%
echo. >> %logfile%
echo Press any key to terminate install ...
pause>nul
GOTO FINISH
:ALLOK
echo ****** Job completed successfully ***** >> %logfile%
echo. >> %logfile%
GOTO FINISH
:FINISH
EXIT /B
You can’t perform that action at this time.