Last active
September 13, 2022 20:38
-
-
Save BoQsc/0d4a34c627ef1048993d5438175a2917 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SETLOCAL EnableDelayedExpansion | |
ECHO TEST PRIVILEGIES > "%windir%\tcc_installation_privilegies.txt" | |
IF NOT EXIST "%windir%\tcc_installation_privilegies.txt" ( | |
ECHO PLEASE ELEVATE PRIVILEGIES BY RUNNING AS ADMINISTRATOR | |
PAUSE | |
EXIT /B | |
) | |
IF EXIST "%windir%\tcc_installation_privilegies.txt" DEL "%windir%\tcc_installation_privilegies.txt" | |
CD "%~DP0" | |
REM OLD INSTALLATION REMOVAL | |
REM Uninstall the Tiny C Compiler | |
REM Scans the log entries and Deletes each entry. | |
IF EXIST "%windir%\tcc.log" ( | |
FOR /F "usebackq tokens=* delims=" %%p IN ("%windir%\tcc.log") DO ( | |
SET "isFOLDER=%%~ap" | |
IF /I "!isFOLDER:~0,1!"=="d" RMDIR /s /q "%%p" | |
IF /I "!isFOLDER:~0,1!"=="-" DEL "%%p" | |
IF EXIST "%%p" ECHO %%p | |
) | |
DEL "%windir%\tcc.log" | |
) | |
ECHO [Installing folders] | |
FOR /D %%D IN (*) DO ( | |
IF NOT "%%D"=="testland" ( | |
MKLINK /D "%windir%\%%~D" "%%~fD" | |
IF "!ERRORLEVEL!"=="0" ECHO %windir%\%%~D >> "%windir%\tcc.log" | |
IF "!ERRORLEVEL!"=="1" ECHO ERROR %%~fD | |
) | |
) | |
ECHO. | |
ECHO [Installing files] | |
FOR %%F IN (*.dll *.exe) DO ( | |
MKLINK "%windir%\%%~F" "%%~fF" | |
IF "!ERRORLEVEL!"=="0" ECHO %windir%\%%~F >> "%windir%\tcc.log" | |
IF "!ERRORLEVEL!"=="1" ECHO ERROR %%~fF | |
) | |
ECHO. | |
ECHO [Showing installation results] | |
"%windir%\tcc.exe" "-vv" | |
ECHO [ALL DONE.] | |
PAUSE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SETLOCAL EnableDelayedExpansion | |
ECHO TEST PRIVILEGIES > "%windir%\tcc_installation_privilegies.txt" | |
IF NOT EXIST "%windir%\tcc_installation_privilegies.txt" ( | |
ECHO PLEASE ELEVATE PRIVILEGIES BY RUNNING AS ADMINISTRATOR | |
PAUSE | |
EXIT /B | |
) | |
IF EXIST "%windir%\tcc_installation_privilegies.txt" DEL "%windir%\tcc_installation_privilegies.txt" | |
REM Uninstall the Tiny C Compiler | |
REM Scans the log entries and Deletes each entry. | |
IF EXIST "%windir%\tcc.log" ( | |
FOR /F "usebackq tokens=* delims=" %%p IN ("%windir%\tcc.log") DO ( | |
SET "isFOLDER=%%~ap" | |
IF /I "!isFOLDER:~0,1!"=="d" RMDIR /s /q "%%p" | |
IF /I "!isFOLDER:~0,1!"=="-" DEL "%%p" | |
IF EXIST "%%p" ECHO %%p | |
ECHO %%p | |
) | |
DEL "%windir%\tcc.log" | |
ECHO [DONE.] | |
) | |
IF NOT EXIST "%windir%\tcc.log" ECHO NOTHING TO UNINSTALL. | |
PAUSE |
CONS: Requires Reinstallation for every file in the inter-folder.
Example: Reinstallation is required for files in Tiny C Compiler\tcc
to become available, but not for files inside folders
\Tiny C Compiler\tcc\doc
\Tiny C Compiler\tcc\examples
\Tiny C Compiler\tcc\include
\Tiny C Compiler\tcc\lib
CONS: To add new folders, a reinstallation needed as well.
You need administrator privilegies anyways to modify things in windir
. So reinstallation is kind of justified.
You need administrator privilegies system wide installation modification. So reinstallation is kind of justified.
THIS IS POINTING TO THE ORIGINAL files and folders, unjustified. Adding new files and folders to the original root folder, will not sync with %windir%
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
REM RMDIR /S /Q ".\testland"
REM MKDIR ".\testland"