Last active
November 16, 2022 17:24
-
-
Save tresf/42ddd8d4a1fac96adccf3d8b5864d051 to your computer and use it in GitHub Desktop.
Add entry to properties file
This file contains 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 | |
NET SESSION >nul 2>&1 | |
if %ERRORLEVEL% EQU 0 ( | |
echo Administrator PRIVILEGES Detected! | |
) else ( | |
echo NOT AN ADMIN! | |
pause | |
exit | |
) | |
REM (e.g. file.whitelist=C\:\\User\\Roaming\\AppData\\CustomDir\\) | |
set prop=file.whitelist | |
set data=%APPDATA%\CustomDir\; | |
type "%PROGRAMFILES%\QZ Tray\qz-tray.properties" |find "%prop%" >nul 2>&1 | |
if %ERRORLEVEL% EQU 0 ( | |
echo. | |
echo Entry file.whitelist already exists, skipping | |
echo. | |
goto show_properties | |
) else ( | |
echo. | |
echo Entry file.whitelist not found, we'll add it | |
echo. | |
) | |
REM Escape special characters | |
set value=%value:\=\\% | |
set value=%value::=\:% | |
echo file.whitelist=%value%>> "%PROGRAMFILES%\QZ Tray\qz-tray.properties" | |
echo. | |
echo Successfully wrote %value% to qz-tray.properties | |
echo. | |
:show_properties | |
type "%PROGRAMFILES%\QZ Tray\qz-tray.properties" | |
echo. | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment