Repository navigation
Expand file tree
/
Copy pathGHOST.bat
More file actions
481 lines (458 loc) · 20.2 KB
/
Copy pathGHOST.bat
File metadata and controls
481 lines (458 loc) · 20.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
@echo off
chcp 65001 >nul
title GHOST - Guided Hardware and OS Scrubbing Toolkit
cd /d "%~dp0"
rem Enable ANSI VT on this console (session-local, no registry writes) and capture the ESC char.
for /f "delims=" %%a in ('powershell -NoProfile -Command "$d='[DllImport(\"kernel32.dll\")]public static extern IntPtr GetStdHandle(int h);[DllImport(\"kernel32.dll\")]public static extern bool SetConsoleMode(IntPtr h,int m);'; Add-Type -MemberDefinition $d -Name Con -Namespace W; [void][W.Con]::SetConsoleMode([W.Con]::GetStdHandle(-11),7); [Console]::Out.Write([string][char]27)"') do set "ESC=%%a"
set "PROMPT_TEXT=Enter your choice: "
if defined ESC set "PROMPT_TEXT=%ESC%[93mEnter your choice: %ESC%[0m"
:MAIN
cls
call :Banner
call :Hdr " ---- GHOST main menu ----"
echo.
call :Opt 1 "IDE Resets" "- device ID + 8 IDE suites"
if defined ESC (echo %ESC%[92m[ 2] %ESC%[97mZCode Multi-Instance ^& Clones %ESC%[90m- launchers, resets, sync%ESC%[0m) else echo [ 2] ZCode Multi-Instance ^& Clones - launchers, resets, sync
if defined ESC (echo %ESC%[92m[ 3] %ESC%[97mSystem ^& GHOST Maintenance %ESC%[90m- shortcuts, watchers, updates%ESC%[0m) else echo [ 3] System ^& GHOST Maintenance - shortcuts, watchers, updates
if defined ESC (echo %ESC%[92m[ 4] %ESC%[97mAutoClaw Multi-Instance ^& Clones %ESC%[90m- launchers, resets, port patch%ESC%[0m) else echo [ 4] AutoClaw Multi-Instance ^& Clones - launchers, resets, port patch
echo.
call :Opt U "Check for updates / update GHOST" "- from GitHub"
call :Opt 0 "Exit" ""
if defined ESC (echo %ESC%[90mTip: You can run multiple options at once by separating them with commas ^(e.g. %ESC%[96m1, 3, 4%ESC%[90m^)%ESC%[0m) else echo Tip: You can run multiple options at once by separating them with commas ^(e.g. 1, 3, 4^)
echo.
set "choice="
set /p choice=%PROMPT_TEXT%
if not defined choice goto MAIN
call :ValidateChoice choice
if errorlevel 1 (
echo Invalid input - menu numbers only, separated by spaces or commas.
timeout /t 2 >nul
goto MAIN
)
if "%choice%"=="0" (
echo Done.
timeout /t 1 >nul
exit
)
set "chain=%choice:,= %"
set "first="
set "rest="
for /f "tokens=1,*" %%a in ("%chain%") do (
set "first=%%a"
set "rest=%%b"
)
if "%first%"=="1" (
set "PENDING_CHAIN=%rest%"
goto RESETS
)
if "%first%"=="2" (
set "PENDING_CHAIN=%rest%"
goto ZCODE
)
if "%first%"=="3" (
set "PENDING_CHAIN=%rest%"
goto MAINT
)
if "%first%"=="4" (
set "PENDING_CHAIN=%rest%"
goto AUTOCLAW
)
if /i "%first%"=="U" if "%rest%"=="" (
call :Run "tools\update_ghost.ps1"
goto MAIN
)
call :RunChain %chain%
goto MAIN
:RESETS
cls
call :Crumb "IDE Resets"
echo.
call :Opt 1 "Change Device ID" "(machine-wide: ALL instances + Qoder)"
call :Opt 2 "Reset Cursor" ""
call :Opt 3 "Reset Windsurf\Devin" ""
call :Opt 4 "Reset Trae" ""
call :Opt 5 "Reset Qoder" ""
call :Opt 6 "Reset QoderWork" ""
call :Opt 7 "Reset ZCode Primary instance" ""
call :Opt 8 "Reset MiniMax/OpenCode" ""
call :Opt 9 "Reset AutoClaw" ""
echo.
call :Opt 0 "Back to Main Menu" ""
echo.
if not defined PENDING_CHAIN goto RESETS_PROMPT
for %%t in (%PENDING_CHAIN%) do call :ResetsOne %%t
set "PENDING_CHAIN="
:RESETS_PROMPT
set "choice="
set /p choice=%PROMPT_TEXT%
if not defined choice goto RESETS_PROMPT
call :ValidateChoice choice
if errorlevel 1 (
echo Invalid input - menu numbers only, separated by spaces or commas.
goto RESETS_PROMPT
)
if "%choice%"=="0" goto MAIN
for %%t in (%choice:,= %) do call :ResetsOne %%t
goto RESETS
:ZCODE
cls
if defined ESC (echo %ESC%[96mGHOST / ZCode Multi-Instance ^& Clones%ESC%[0m) else echo GHOST / ZCode Multi-Instance ^& Clones
echo.
call :Div "Launch Clones"
call :Opt 1 "Launch Second instance" "- Blue branding (independent window)"
call :Opt 2 "Install clone shortcuts" "- all 3 - Desktop + Start menu"
call :Opt 3 "Launch Third instance" "- Yellow branding (independent window)"
call :Opt 4 "Launch Fourth instance" "- Green branding (independent window)"
call :Opt 5 "Launch ALL clones" "- Second + Third + Fourth"
echo.
call :Div "Reset Clones"
call :Opt 6 "Reset Second instance" "(survivor kept running)"
call :Opt 7 "Reset Second + Primary" "(independent IDs)"
call :Opt 8 "Reset Third instance - Yellow" "(survivors kept running)"
call :Opt 9 "Reset Fourth instance - Green" "(survivors kept running)"
call :Opt 10 "Reset ALL FOUR instances" "(independent IDs)"
echo.
if defined ESC (echo %ESC%[90m -- Sync ^& Watchers --%ESC%[0m) else echo -- Sync ^& Watchers --
call :Opt 11 "Captcha watchdog" "(unattended, separate window)"
call :Opt 12 "Re-apply app patch - v7, icons + bidi auto" "(after app update)"
call :Opt 13 "Refresh Second chats" "- show Primary chats without app restart"
call :Opt 14 "Watch errors" "- auto-refresh chats on quota or captcha failure"
call :Opt 15 "Refresh chats - ALL instances" "- re-index every running sidebar"
call :Opt 16 "Taskbar identity watcher" "- auto-fix taskbar merges (separate window)"
call :Opt 17 "Freeze diagnostic" "- dead windows, renderer OOM, commit pressure"
echo.
call :Opt 0 "Back to Main Menu" ""
echo.
if not defined PENDING_CHAIN goto ZCODE_PROMPT
for %%t in (%PENDING_CHAIN%) do call :ZCodeOne %%t
set "PENDING_CHAIN="
:ZCODE_PROMPT
set "choice="
set /p choice=%PROMPT_TEXT%
if not defined choice goto ZCODE_PROMPT
call :ValidateChoice choice
if errorlevel 1 (
echo Invalid input - menu numbers only, separated by spaces or commas.
goto ZCODE_PROMPT
)
if "%choice%"=="0" goto MAIN
for %%t in (%choice:,= %) do call :ZCodeOne %%t
goto ZCODE
:MAINT
cls
if defined ESC (echo %ESC%[96mGHOST / System ^& GHOST Maintenance%ESC%[0m) else echo GHOST / System ^& GHOST Maintenance
echo.
call :Opt 1 "Install or repair the GHOST shortcut" "- Desktop + repo folder"
call :Opt 2 "Check for updates / update GHOST" "- from GitHub"
echo.
call :Opt 0 "Back to Main Menu" ""
echo.
if not defined PENDING_CHAIN goto MAINT_PROMPT
for %%t in (%PENDING_CHAIN%) do call :MaintOne %%t
set "PENDING_CHAIN="
:MAINT_PROMPT
set "choice="
set /p choice=%PROMPT_TEXT%
if not defined choice goto MAINT_PROMPT
call :ValidateChoice choice
if errorlevel 1 (
echo Invalid input - menu numbers only, separated by spaces or commas.
goto MAINT_PROMPT
)
if "%choice%"=="0" goto MAIN
for %%t in (%choice:,= %) do call :MaintOne %%t
goto MAINT
:AUTOCLAW
cls
if defined ESC (echo %ESC%[96mGHOST / AutoClaw Multi-Instance ^& Clones%ESC%[0m) else echo GHOST / AutoClaw Multi-Instance ^& Clones
echo.
call :Div "Launch Clones"
call :Opt 1 "Launch inst1" "- first clone (own profile, identity, ports)"
call :Opt 2 "Install clone shortcuts" "- all 4 - Desktop + Start menu"
call :Opt 3 "Launch inst2" ""
call :Opt 4 "Launch inst3" ""
call :Opt 5 "Launch ALL clones" "- inst1..inst4, one after another"
echo.
call :Div "Reset Clones"
call :Opt 6 "Reset inst1" "(auto closes AutoClaw)"
call :Opt 7 "Reset inst2" ""
call :Opt 8 "Reset inst3" ""
call :Opt 9 "Reset inst4" ""
call :Opt 10 "Reset ALL instances" "- clones + Primary, independent IDs"
echo.
if defined ESC (echo %ESC%[90m -- Maintenance --%ESC%[0m) else echo -- Maintenance --
call :Opt 11 "Apply MCP port patch - 8 slots" "(after app update; AutoClaw must be closed)"
call :Opt 12 "Clone status" "- processes, actual ports, health"
echo.
call :Opt 0 "Back to Main Menu" ""
echo.
if not defined PENDING_CHAIN goto AUTOCLAW_PROMPT
for %%t in (%PENDING_CHAIN%) do call :AutoClawOne %%t
set "PENDING_CHAIN="
:AUTOCLAW_PROMPT
set "choice="
set /p choice=%PROMPT_TEXT%
if not defined choice goto AUTOCLAW_PROMPT
call :ValidateChoice choice
if errorlevel 1 (
echo Invalid input - menu numbers only, separated by spaces or commas.
goto AUTOCLAW_PROMPT
)
if "%choice%"=="0" goto MAIN
for %%t in (%choice:,= %) do call :AutoClawOne %%t
goto AUTOCLAW
:UnknownTask
rem Red "not found" message for a bad task id (shared by all resolvers).
if defined ESC echo %ESC%[91mUnknown task "%~1" - check the menu and try again.%ESC%[0m
if not defined ESC echo Unknown task "%~1" - check the menu and try again.
exit /b
:ValidateChoice
rem %1 = NAME of the variable holding raw user input. errorlevel 1 = reject.
rem Allowlist: digits, spaces, commas, U/u - menu ids, chain separators and
rem the update shortcut. Everything else (quotes, ampersands, parens, carets,
rem percent signs, non-ASCII) is rejected BEFORE any expansion uses the value,
rem so the unquoted %%chain%% / %%choice%% expansions downstream can never
rem split tokens or inject commands (self-input hardening, 2026-10-17).
rem The probe runs in an isolated delayed-expansion scope: !var! values are
rem post-parse DATA, so hostile characters cannot break out of the probe
rem itself. ('!' in the raw value vanishes inside the probe and is inert to
rem %-expansion, so a value carrying it can safely pass the allowlist.)
setlocal EnableDelayedExpansion EnableExtensions
set "VC_VAL=!%~1!"
if not defined VC_VAL ( endlocal & exit /b 1 )
rem Space must be the LAST delim char (for /f splits option groups at spaces
rem and commas - a mid-string space breaks the options parse). eol=; is the
rem default and stays: a value starting with ';' skips the probe but ';' is
rem inert to cmd expansion, so the residual risk is an Unknown-task token.
for /f "eol=; delims=0123456789,Uu " %%z in ("!VC_VAL!") do ( endlocal & exit /b 1 )
endlocal & exit /b 0
:ResetsOne
rem Resolves an IDE Resets submenu-local id to its global task id and runs it.
rem Local ids 1-8 equal the global ids; [9] maps to gid 28 - gid 9 is the ZCode captcha watchdog.
set "RESOLVED="
if "%~1"=="1" set "RESOLVED=1"
if "%~1"=="2" set "RESOLVED=2"
if "%~1"=="3" set "RESOLVED=3"
if "%~1"=="4" set "RESOLVED=4"
if "%~1"=="5" set "RESOLVED=5"
if "%~1"=="6" set "RESOLVED=6"
if "%~1"=="7" set "RESOLVED=7"
if "%~1"=="8" set "RESOLVED=8"
if "%~1"=="9" set "RESOLVED=28"
if not defined RESOLVED call :UnknownTask "%~1"
if not defined RESOLVED exit /b
call :DispatchOne %RESOLVED%
exit /b
:ZCodeOne
rem Resolves a ZCode submenu-local id to its global task id and runs it.
set "RESOLVED="
if "%~1"=="1" set "RESOLVED=10"
if "%~1"=="2" set "RESOLVED=14"
if "%~1"=="3" set "RESOLVED=16"
if "%~1"=="4" set "RESOLVED=17"
if "%~1"=="5" set "RESOLVED=18"
if "%~1"=="6" set "RESOLVED=11"
if "%~1"=="7" set "RESOLVED=12"
if "%~1"=="8" set "RESOLVED=19"
if "%~1"=="9" set "RESOLVED=20"
if "%~1"=="10" set "RESOLVED=21"
if "%~1"=="11" set "RESOLVED=9"
if "%~1"=="12" set "RESOLVED=13"
if "%~1"=="13" set "RESOLVED=15"
if "%~1"=="14" set "RESOLVED=22"
if "%~1"=="15" set "RESOLVED=23"
if "%~1"=="16" set "RESOLVED=25"
if "%~1"=="17" set "RESOLVED=27"
if not defined RESOLVED call :UnknownTask "%~1"
if not defined RESOLVED exit /b
call :DispatchOne %RESOLVED%
exit /b
:MaintOne
rem Resolves a Maintenance submenu-local id to its global task id and runs it.
set "RESOLVED="
if "%~1"=="1" set "RESOLVED=24"
if "%~1"=="2" set "RESOLVED=26"
if not defined RESOLVED call :UnknownTask "%~1"
if not defined RESOLVED exit /b
call :DispatchOne %RESOLVED%
exit /b
:AutoClawOne
rem Resolves an AutoClaw submenu-local id to its global task id and runs it.
set "RESOLVED="
if "%~1"=="1" set "RESOLVED=29"
if "%~1"=="2" set "RESOLVED=30"
if "%~1"=="3" set "RESOLVED=31"
if "%~1"=="4" set "RESOLVED=32"
if "%~1"=="5" set "RESOLVED=33"
if "%~1"=="6" set "RESOLVED=34"
if "%~1"=="7" set "RESOLVED=35"
if "%~1"=="8" set "RESOLVED=36"
if "%~1"=="9" set "RESOLVED=37"
if "%~1"=="10" set "RESOLVED=38"
if "%~1"=="11" set "RESOLVED=39"
if "%~1"=="12" set "RESOLVED=40"
if not defined RESOLVED call :UnknownTask "%~1"
if not defined RESOLVED exit /b
call :DispatchOne %RESOLVED%
exit /b
:DispatchOne
rem Runs one task by global id (1-40). Unknown ids print an error. Returns to caller.
if "%~1"=="1" (call :Run "src\windows\change_device_id.ps1" & exit /b)
if "%~1"=="2" (call :Run "src\windows\reset_cursor.ps1" & exit /b)
if "%~1"=="3" (call :Run "src\windows\reset_devin.ps1" & exit /b)
if "%~1"=="4" (call :Run "src\windows\reset_trae.ps1" & exit /b)
if "%~1"=="5" (call :Run "src\windows\reset_qoder.ps1" & exit /b)
if "%~1"=="6" (call :Run "src\windows\reset_qoderwork.ps1" & exit /b)
if "%~1"=="7" (call :Run "src\windows\reset_zcode.ps1" -Target Primary & exit /b)
if "%~1"=="8" (call :Run "src\windows\reset_minimax_opencode.ps1" & exit /b)
if "%~1"=="9" (call :Detached "ZCode captcha watch" "-NoExit -NoProfile" "tools\watch_zcode_captcha.ps1" "" "Watchdog launched in a separate window - leave it open." "To verify it runs: check %LOCALAPPDATA%\watch-zcode-captcha\watch.log" & exit /b)
if "%~1"=="10" (call :Detached "ZCode Second Instance" "-NoProfile" "src\windows\launch_zcode_second_instance.ps1" "" "Launcher opened in a separate window - it closes automatically when done." & exit /b)
if "%~1"=="11" (call :Run "src\windows\reset_zcode.ps1" -Target Secondary & exit /b)
if "%~1"=="12" (call :Run "src\windows\reset_zcode.ps1" -Target Both & exit /b)
if "%~1"=="13" (call :RunWith "tools\patch_zcode_icon_override.ps1" "Patch finished - if it reported ZCode.exe running, close ALL ZCode instances and run this option again." & exit /b)
if "%~1"=="14" (call :RunWith "tools\install_zcode_second_shortcuts.ps1" "Look for the new ZCode Second, ZCode Third and ZCode Fourth shortcuts on your Desktop and in the Start menu." & exit /b)
if "%~1"=="15" (call :RunWith "tools\refresh_zcode_second_chats.ps1" "The blue Secondary window refreshes its chat list by itself in a few seconds." & exit /b)
if "%~1"=="16" (call :Detached "ZCode Third Instance" "-NoProfile" "src\windows\launch_zcode_second_instance.ps1" "-Instance Third" "Launcher opened in a separate window - it closes automatically when done." & exit /b)
if "%~1"=="17" (call :Detached "ZCode Fourth Instance" "-NoProfile" "src\windows\launch_zcode_second_instance.ps1" "-Instance Fourth" "Launcher opened in a separate window - it closes automatically when done." & exit /b)
if "%~1"=="18" (
call :StartClone "ZCode Second Instance" "src\windows\launch_zcode_second_instance.ps1"
timeout /t 3 /nobreak >nul
call :StartClone "ZCode Third Instance" "src\windows\launch_zcode_second_instance.ps1" "-Instance Third"
timeout /t 3 /nobreak >nul
call :StartClone "ZCode Fourth Instance" "src\windows\launch_zcode_second_instance.ps1" "-Instance Fourth"
echo Three launcher windows opened - each closes automatically when done.
echo First runs clone the Primary profile, so expect a short delay per clone.
pause
exit /b
)
if "%~1"=="19" (call :Run "src\windows\reset_zcode.ps1" -Target Third & exit /b)
if "%~1"=="20" (call :Run "src\windows\reset_zcode.ps1" -Target Fourth & exit /b)
if "%~1"=="21" (call :Run "src\windows\reset_zcode.ps1" -Target All & exit /b)
if "%~1"=="22" (call :Detached "ZCode error chat refresh" "-NoExit -NoProfile" "tools\refresh_zcode_second_chats.ps1" "-Target All -Watch" "Error watcher launched in a separate window - leave it open." "On quota, captcha or rate-limit failures it refreshes chats in every running ZCode instance." & exit /b)
if "%~1"=="23" (call :Run "tools\refresh_zcode_second_chats.ps1" -Target All & exit /b)
if "%~1"=="24" (call :RunWith "tools\install_ghost_shortcut.ps1" "Check your Desktop for the GHOST shortcut - re-run this after moving this repo folder." & exit /b)
if "%~1"=="25" (call :Detached "ZCode taskbar identity" "-NoProfile" "tools\watch_zcode_taskbar.ps1" "" "Taskbar identity watcher launched in a separate window - leave it open." "It re-stamps any ZCode window that loses its taskbar identity within seconds." & exit /b)
if "%~1"=="26" (call :Run "tools\update_ghost.ps1" & exit /b)
if "%~1"=="27" (call :Run "tools\diagnose_zcode_freeze.ps1" & exit /b)
if "%~1"=="28" (call :Run "src\windows\reset_autoclaw.ps1" -Target Primary & exit /b)
if "%~1"=="29" (call :Detached "AutoClaw inst1" "-NoProfile" "src\windows\launch_autoclaw_clone.ps1" "" "Launcher opened in a separate window - it closes automatically when done." & exit /b)
if "%~1"=="30" (call :RunWith "tools\install_autoclaw_clone_shortcuts.ps1" "Look for the new AutoClaw inst1 - inst4 shortcuts on your Desktop and in the Start menu." & exit /b)
if "%~1"=="31" (call :Detached "AutoClaw inst2" "-NoProfile" "src\windows\launch_autoclaw_clone.ps1" "-Instance inst2" "Launcher opened in a separate window - it closes automatically when done." & exit /b)
if "%~1"=="32" (call :Detached "AutoClaw inst3" "-NoProfile" "src\windows\launch_autoclaw_clone.ps1" "-Instance inst3" "Launcher opened in a separate window - it closes automatically when done." & exit /b)
if "%~1"=="33" (
call :StartClone "AutoClaw inst1" "src\windows\launch_autoclaw_clone.ps1"
timeout /t 3 /nobreak >nul
call :StartClone "AutoClaw inst2" "src\windows\launch_autoclaw_clone.ps1" "-Instance inst2"
timeout /t 3 /nobreak >nul
call :StartClone "AutoClaw inst3" "src\windows\launch_autoclaw_clone.ps1" "-Instance inst3"
timeout /t 3 /nobreak >nul
call :StartClone "AutoClaw inst4" "src\windows\launch_autoclaw_clone.ps1" "-Instance inst4"
echo Four launcher windows opened - each closes automatically when done.
echo First runs clone the Primary profile, so expect a short delay per clone.
echo Launch them one at a time the first time to log in once per clone.
pause
exit /b
)
if "%~1"=="34" (call :Run "src\windows\reset_autoclaw.ps1" -Target inst1 & exit /b)
if "%~1"=="35" (call :Run "src\windows\reset_autoclaw.ps1" -Target inst2 & exit /b)
if "%~1"=="36" (call :Run "src\windows\reset_autoclaw.ps1" -Target inst3 & exit /b)
if "%~1"=="37" (call :Run "src\windows\reset_autoclaw.ps1" -Target inst4 & exit /b)
if "%~1"=="38" (call :Run "src\windows\reset_autoclaw.ps1" -Target All & exit /b)
if "%~1"=="39" (call :RunWith "tools\patch_autoclaw_ports.ps1" "Patch finished - if it reported AutoClaw.exe running, close ALL AutoClaw windows and run this option again." & exit /b)
if "%~1"=="40" (call :Run "src\windows\launch_autoclaw_clone.ps1" -Status & exit /b)
call :UnknownTask "%~1"
exit /b
:RunChain
rem Runs each task id in the chain sequentially, no menu between tasks. Returns to caller.
if "%~1"=="" exit /b
for %%t in (%*) do call :DispatchOne %%t
exit /b
:Crumb
rem One-line breadcrumb for submenus (the full banner stays on the main menu only).
if not defined ESC goto CrumbPlain
echo %ESC%[96mGHOST / %~1%ESC%[0m
exit /b
:CrumbPlain
echo GHOST / %~1
exit /b
:Banner
if not defined ESC goto BannerPlain
echo %ESC%[96m
echo.
echo ____ _ _ ___ ____ _____
echo / ___^| ^| ^| ^|/ _ \/ ___^|_ _^|
echo ^| ^| _^| ^|_^| ^| ^| ^| \___ \ ^| ^|
echo ^| ^|_^| ^| _ ^| ^|_^| ^|___) ^|^| ^|
echo \____^|_^| ^|_^|\___/^|____/ ^|_^|
echo.
echo GHOST - Guided Hardware ^& OS Scrubbing Toolkit%ESC%[0m
echo.
exit /b
:BannerPlain
echo.
echo ____ _ _ ___ ____ _____
echo / ___^| ^| ^| ^|/ _ \/ ___^|_ _^|
echo ^| ^| _^| ^|_^| ^| ^| ^| \___ \ ^| ^|
echo ^| ^|_^| ^| _ ^| ^|_^| ^|___) ^|^| ^|
echo \____^|_^| ^|_^|\___/^|____/ ^|_^|
echo.
echo GHOST - Guided Hardware ^& OS Scrubbing Toolkit
echo.
exit /b
:Hdr
if not defined ESC goto HdrPlain
echo %ESC%[96m%~1%ESC%[0m
exit /b
:HdrPlain
echo %~1
exit /b
:Div
if not defined ESC goto DivPlain
echo %ESC%[90m -- %~1 --%ESC%[0m
exit /b
:DivPlain
echo -- %~1 --
exit /b
:Opt
rem Option line: padded id, label, optional gray tail. Three-tone when ANSI is on.
set "OID= %~1"
set "OID=%OID:~-2%"
if not defined ESC goto OptPlain
if "%~3"=="" goto OptNoTail
echo %ESC%[92m[%OID%] %ESC%[97m%~2 %ESC%[90m%~3%ESC%[0m
exit /b
:OptNoTail
echo %ESC%[92m[%OID%] %ESC%[97m%~2%ESC%[0m
exit /b
:OptPlain
if "%~3"=="" echo [%OID%] %~2
if not "%~3"=="" echo [%OID%] %~2 %~3
exit /b
:Run
rem Runs a script inline (up to 3 extra args), then returns to the caller.
rem Usage: call :Run <script> [args...]
powershell -NoProfile -ExecutionPolicy Bypass -File "%~1" %2 %3 %4
pause
exit /b
:RunWith
rem Runs a script inline (no extra args), prints a follow-up note, then returns to the caller.
rem Usage: call :RunWith <script> <note>
powershell -NoProfile -ExecutionPolicy Bypass -File "%~1"
echo.
echo %~2
pause
exit /b
:Detached
rem Launches a script in a new window via start, prints status notes, then returns to the caller.
rem Usage: call :Detached <window title> <powershell flags> <script> [script args] <note> [extra note]
start "%~1" powershell %~2 -ExecutionPolicy Bypass -File "%~3" %~4
echo.
echo %~5
if not "%~6"=="" echo %~6
pause
exit /b
:StartClone
rem Launches a clone window only; the caller prints notes and pauses. Returns to caller.
rem Usage: call :StartClone <window title> <script> [script args]
start "%~1" powershell -NoProfile -ExecutionPolicy Bypass -File "%~2" %~3
exit /b