@echo off
rem this script copies the tools folder ...

set T=%SystemDrive%\TEMP
set TOOLS=%SystemDrive%\tools
set SCRIPTS=%TOOLS%\scripts

echo ####### %0 #######

echo killing ssh agent ...
taskkill /F /IM ssh-agent.exe 2>nul
taskkill /F /IM ssh.exe 2>nul
echo.

echo killing WinAuth ...
taskkill /F /IM WinAuth.exe 2>nul
echo.

echo killing Desktopinfo ...
taskkill /F /IM DesktopInfo64.exe 2>nul
echo.

echo saving snapcontrol.ini ...
copy /Y %TOOLS%\snapcontrol.ini %SystemDrive% 1>nul 2>nul

echo deleting %TOOLS% ...
takeown /F %TOOLS% /R /D Y 1>nul
rd /S /Q %TOOLS% 2>nul
echo.

echo copying folder %TOOLS% ...
robocopy tools %TOOLS% /MIR /256 /V /NJH /NFL
echo.

echo creating %T% ...
mkdir %T% 1>nul 2>nul
echo.

echo cd to %SCRIPTS% ...
cd /D %SCRIPTS%
echo.

rem 7-zip is essential for other scripts ...
call unpack-7zip.cmd
echo.

rem windows update blocker is in the zipfiles ...
call unpack-zipfiles.cmd
echo.

rem put vnc in place ...
call unpack-vnc.cmd
echo.

rem copy some other stuff ...
call copy-executables.cmd
echo.

rem dont forget the shortcuts ...
call install-shortcuts.cmd
echo.

call install-git.cmd
echo.

echo moving snapcontrol.ini back to tools folder ...
move /Y %SystemDrive%\snapcontrol.ini %TOOLS% 1>nul 2>nul

echo setting permissions for [ %TOOLS% ] ...
cd /D %SystemDrive%\
takeown /F %TOOLS% /R /A /D Y 1>nul
icacls %TOOLS% /inheritance:r
icacls %TOOLS% /grant Administrators:F /t /c /l 1>nul
icacls %TOOLS% /grant Users:RX /t /c /l 1>nul
echo.

echo ####### %0 #######
echo READY.
echo.