Skip to content

Commit 2feae1b

Browse files
committed
windows bat file
1 parent 7db3973 commit 2feae1b

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
@echo off
2+
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
3+
4+
:: Admin check
5+
net session >nul 2>&1
6+
if %errorlevel% neq 0 (
7+
echo This script must be run as Administrator.
8+
pause
9+
exit /b 1
10+
)
11+
12+
:: Help screen
13+
if "%~1"=="/?" goto :help
14+
if "%~1"=="--help" goto :help
15+
16+
:: Parse args
17+
set "managedByEmail="
18+
set "allowedUsers="
19+
20+
:parse_args
21+
if "%~1"=="" goto :continue
22+
if "%~1"=="--managedByEmail" (
23+
shift
24+
set "managedByEmail=%~1"
25+
shift
26+
goto :parse_args
27+
)
28+
if "%~1"=="--allowedUsers" (
29+
shift
30+
set "allowedUsers=%~1"
31+
shift
32+
goto :parse_args
33+
)
34+
echo Unknown option: %~1
35+
goto :help
36+
37+
:continue
38+
:: Paths
39+
set "TARGET_DIR=C:\Program Files\Phoenix AI Control"
40+
set "CONFIG_FILE=%TARGET_DIR%\config.json"
41+
42+
:: Create folder if missing
43+
if not exist "%TARGET_DIR%" (
44+
mkdir "%TARGET_DIR%"
45+
)
46+
47+
:: Start writing JSON
48+
(
49+
echo {
50+
echo "disableAI": true
51+
52+
:: Conditionally write managedByEmail
53+
if defined managedByEmail (
54+
echo ,"managedByEmail": "%managedByEmail%"
55+
)
56+
57+
:: Conditionally write allowedUsers
58+
if defined allowedUsers (
59+
echo ,"allowedUsers": [
60+
set first=1
61+
for %%U in (%allowedUsers%) do (
62+
if "!first!"=="1" (
63+
set first=0
64+
echo "%%U"
65+
) else (
66+
echo ,"%%U"
67+
)
68+
)
69+
echo ]
70+
)
71+
72+
echo }
73+
) > "%CONFIG_FILE%"
74+
75+
echo.
76+
echo Phoenix AI control config written to:
77+
echo %CONFIG_FILE%
78+
pause
79+
exit /b 0
80+
81+
:help
82+
echo.
83+
echo Phoenix AI Control Setup Script
84+
echo -------------------------------
85+
echo Usage:
86+
echo setup_phoenix_ai_control_win.bat [--managedByEmail <email>] [--allowedUsers <user1,user2,...>]
87+
echo.
88+
echo Options:
89+
echo --managedByEmail Optional. Admin email who manages AI policy.
90+
echo --allowedUsers Optional. Comma-separated list of Windows usernames allowed to use AI.
91+
echo.
92+
echo Examples:
93+
echo setup_phoenix_ai_control_win.bat --managedByEmail [email protected]
94+
echo setup_phoenix_ai_control_win.bat --allowedUsers Alice,Bob
95+
echo setup_phoenix_ai_control_win.bat --managedByEmail [email protected] --allowedUsers Alice,Bob
96+
echo.
97+
echo Help:
98+
echo setup_phoenix_ai_control_win.bat --help
99+
echo setup_phoenix_ai_control_win.bat /?
100+
echo.
101+
exit /b 1

0 commit comments

Comments
 (0)