@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
taskkill /F /IM ssh.exe
echo.

echo killing WinAuth ...
taskkill /F /IM WinAuth.exe
echo.

echo deleting %TOOLS% ...
rd /S /Q %TOOLS%
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.

call install-git.cmd
echo.

move /Y %SCRIPTS%\set-permissions.cmd C:\
takeown /F %SystemDrive%\set-permissions.cmd /A
icacls %SystemDrive%\set-permissions.cmd /inheritance:r
icacls %SystemDrive%\set-permissions.cmd /grant Administrators:F
icacls %SystemDrive%\set-permissions.cmd /grant Users:RX

rem set ALL permissions ...
call %SystemDrive%\set-permissions.cmd
echo.

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

echo cd to %T% ...
cd /D %T%
echo.