Skip to content

Commit 4c6c7d3

Browse files
committed
windows bat file working
1 parent 101b4c2 commit 4c6c7d3

File tree

2 files changed

+115
-184
lines changed

2 files changed

+115
-184
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
@echo off
2+
:: Phoenix AI Control – Windows setup script
3+
:: Flags: --managedByEmail, --allowedUsers, --disableAI, --help
4+
:: Writes JSON to: C:\Program Files\Phoenix AI Control\config.json
5+
:: -------------------------------------------------------------------------
6+
7+
setlocal EnableDelayedExpansion
8+
9+
:: ───────────────────────── Defaults ───────────────────────────────────────
10+
set "managedByEmail="
11+
set "allowedUsers="
12+
set "disableAI=false"
13+
14+
:: ──────────────────────── Help first ──────────────────────────────────────
15+
if /I "%~1"=="--help" goto :show_help
16+
17+
:: ─────────────── Require Administrator privileges ────────────────────────
18+
>nul 2>&1 net session || (
19+
echo.
20+
echo This script must be run as **Administrator**.
21+
exit /b 1
22+
)
23+
24+
:: ───────────────────── Parse CLI arguments ────────────────────────────────
25+
:parse_args
26+
if "%~1"=="" goto :after_parse
27+
if /I "%~1"=="--managedByEmail" (
28+
set "managedByEmail=%~2"
29+
if "%managedByEmail%"=="[email protected]" (
30+
echo Error: please provide a real admin email address.
31+
exit /b 1
32+
)
33+
shift
34+
) else if /I "%~1"=="--allowedUsers" (
35+
set "allowedUsers=%~2"
36+
shift
37+
) else if /I "%~1"=="--disableAI" (
38+
set "disableAI=true"
39+
) else (
40+
echo Unknown option: %~1
41+
goto :show_help
42+
)
43+
shift
44+
goto :parse_args
45+
46+
:after_parse
47+
:: ───────────────────── Target paths ───────────────────────────────────────
48+
set "TARGET_DIR=C:\Program Files\Phoenix AI Control"
49+
set "CONFIG_FILE=%TARGET_DIR%\config.json"
50+
if not exist "%TARGET_DIR%" mkdir "%TARGET_DIR%"
51+
52+
:: ───────────────────── Build JSON string ──────────────────────────────────
53+
REM 1. base object -> {"disableAI": false
54+
set json_content={^"disableAI^": %disableAI%
55+
56+
REM 2. optional managedByEmail
57+
if defined managedByEmail (
58+
set json_content=%json_content%, ^"managedByEmail^": ^"%managedByEmail%^"
59+
)
60+
61+
REM 3. optional allowedUsers
62+
if defined allowedUsers (
63+
set json_content=%json_content%, ^"allowedUsers^": [
64+
set first=1
65+
for %%U in (%allowedUsers:,= %) do (
66+
if !first! equ 1 (
67+
set json_content=!json_content!^"%%U^"
68+
set first=0
69+
) else (
70+
set json_content=!json_content!, ^"%%U^"
71+
)
72+
)
73+
set json_content=!json_content!]
74+
)
75+
76+
REM 4. close object -> ... }
77+
set json_content=!json_content!}
78+
79+
:: ───────────────────── Write file ─────────────────────────────────────────
80+
> "%CONFIG_FILE%" echo(!json_content!
81+
82+
:: ───────────────────── Show result ────────────────────────────────────────
83+
echo.
84+
echo Phoenix AI control config written to:
85+
echo "%CONFIG_FILE%"
86+
echo.
87+
echo Configuration contents:
88+
echo ----------------------
89+
type "%CONFIG_FILE%"
90+
echo ----------------------
91+
echo.
92+
echo NOTE: Running this script again overwrites the previous configuration.
93+
exit /b 0
94+
95+
96+
:show_help
97+
echo.
98+
echo Phoenix AI Control Setup Script
99+
echo --------------------------------
100+
echo Usage:
101+
echo setup_phoenix_ai_control_windows.bat [--managedByEmail ^<email^>] [--allowedUsers ^<u1,u2,...^>] [--disableAI]
102+
echo.
103+
echo Options:
104+
echo --managedByEmail Admin email for AI policy management (optional)
105+
echo --allowedUsers Comma‑separated list of Windows usernames (optional)
106+
echo --disableAI If present, AI is disabled by default (optional)
107+
echo --help Show this help
108+
echo.
109+
echo Examples:
110+
echo setup_phoenix_ai_control_windows.bat --managedByEmail [email protected]
111+
echo setup_phoenix_ai_control_windows.bat --allowedUsers alice,bob
112+
echo setup_phoenix_ai_control_windows.bat --managedByEmail [email protected] --allowedUsers alice,bob --disableAI
113+
echo.
114+
echo Running this script overwrites any previous configuration.
115+
exit /b 1

install_scripts/setup_phoenix_ai_control_win.ps1

Lines changed: 0 additions & 184 deletions
This file was deleted.

0 commit comments

Comments
 (0)