-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpotXMultitool.bat
More file actions
1196 lines (1100 loc) · 38.3 KB
/
Copy pathSpotXMultitool.bat
File metadata and controls
1196 lines (1100 loc) · 38.3 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
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
@echo off
:: ===================================================================
:: SpotX Multitool - Windows power tools, all in one place
:: Open source (MIT). https://github.com/Azad0008/SpotX-Multitool
:: Target: Windows 10 / 11 | Run as administrator
:: ===================================================================
setlocal EnableExtensions EnableDelayedExpansion
set "APP_NAME=SpotX Multitool"
set "APP_VER=1.0.0"
title %APP_NAME% v%APP_VER%
:: Folder this script runs from. The cleaner refuses to delete it, so
:: running the tool out of a temp folder cannot wipe the script itself.
set "SCRIPTDIR=%~dp0"
:: ---- Request administrator rights (UAC self-elevation) ------------
net session >nul 2>&1
if not "%errorlevel%"=="0" (
echo Requesting administrator privileges...
powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs" >nul 2>&1
exit /b
)
:: ---- Console setup -------------------------------------------------
mode con: cols=104 >nul 2>&1
color 0f
:: ---- Define the ESC (0x1B) character + enable RGB colors ----------
for /f %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"
set "PCT=%%"
set "R=%ESC%[0m"
set "B=%ESC%[1m"
set "HOTPINK=%ESC%[38;2;255;92;170m"
set "PINK=%ESC%[38;2;255;40;140m"
set "MAG=%ESC%[38;2;236;0;230m"
set "PU2=%ESC%[38;2;205;70;255m"
set "PURPLE=%ESC%[38;2;168;85;247m"
set "WHITE=%ESC%[38;2;240;240;245m"
set "GRAY=%ESC%[38;2;128;128;140m"
set "GREEN=%ESC%[38;2;60;220;130m"
set "AMBER=%ESC%[38;2;255;180;60m"
set "RED=%ESC%[38;2;255;80;90m"
set "CYAN=%ESC%[38;2;90;210;255m"
:: ---- SPOTX ASCII banner rows --------------------------------------
set "ROW1= #### ##### #### ###### # #"
set "ROW2=# # # # # ## # # "
set "ROW3= #### ##### # # ## ## "
set "ROW4= # # # # ## # # "
set "ROW5= #### # #### ## # #"
call :Intro
goto MAIN
:: ===================================================================
:: MAIN MENU
:: ===================================================================
:MAIN
cls
call :LogoStatic
echo(
echo %GRAY% +=============================[ %WHITE%MAIN MENU%GRAY% ]=============================+%R%
echo(
echo %MAG%[1]%R% %WHITE%Cleaner%R% %GRAY%Wipe temp, caches, recycle bin%R%
echo %MAG%[2]%R% %WHITE%Network Tools%R% %GRAY%Flush DNS, reset stack, Wi-Fi info%R%
echo %MAG%[3]%R% %WHITE%System Info%R% %GRAY%Hardware, OS, disk report%R%
echo %MAG%[4]%R% %WHITE%System Repair%R% %GRAY%SFC, DISM, Windows Update fix%R%
echo %MAG%[5]%R% %WHITE%Optimize%R% %GRAY%Startup, power plan, privacy%R%
echo %MAG%[6]%R% %WHITE%Security%R% %GRAY%Defender, firewall, ports%R%
echo %MAG%[7]%R% %WHITE%Utilities%R% %GRAY%Restore point, GodMode, hosts%R%
echo %MAG%[8]%R% %WHITE%About%R%
echo(
echo %RED%[0]%R% %GRAY%Exit%R%
echo(
call :hr
set "sel="
set /p "sel=%PINK% Choose an option:%R% "
if "%sel%"=="1" goto CLEANER
if "%sel%"=="2" goto NETWORK
if "%sel%"=="3" goto SYSINFO
if "%sel%"=="4" goto REPAIR
if "%sel%"=="5" goto OPTIMIZE
if "%sel%"=="6" goto SECURITY
if "%sel%"=="7" goto UTIL
if "%sel%"=="8" goto ABOUT
if "%sel%"=="0" goto QUIT
goto MAIN
:: ===================================================================
:: CLEANER
:: ===================================================================
:CLEANER
cls
call :BannerSmall
echo(
echo %MAG% == %WHITE%CLEANER %MAG%==%R%
call :hr
echo(
echo %MAG%[1]%R% %WHITE%Quick Clean %GRAY%(user temp, recent, thumbnails)%R%
echo %MAG%[2]%R% %WHITE%Deep Clean %GRAY%(Windows temp, update cache, logs)%R%
echo %MAG%[3]%R% %WHITE%Empty Recycle Bin%R%
echo %MAG%[4]%R% %WHITE%Clean Browser Caches%R%
echo %MAG%[5]%R% %WHITE%FULL Clean %GRAY%(everything above)%R%
echo %MAG%[6]%R% %WHITE%Show Disk Space%R%
echo %MAG%[7]%R% %WHITE%Windows Disk Cleanup%R%
echo %MAG%[8]%R% %WHITE%Reset Microsoft Store Cache%R%
echo(
echo %GRAY%[B] Back%R%
echo(
call :hr
set "sel="
set /p "sel=%PINK% Choose an option:%R% "
if "%sel%"=="1" call :Do_QuickClean
if "%sel%"=="2" call :Do_DeepClean
if "%sel%"=="3" call :Do_RecycleBin
if "%sel%"=="4" call :Do_BrowserClean
if "%sel%"=="5" call :Do_FullClean
if "%sel%"=="6" call :Do_DiskSpace
if "%sel%"=="7" call :Do_DiskCleanup
if "%sel%"=="8" call :Do_StoreReset
if /I "%sel%"=="B" goto MAIN
goto CLEANER
:Do_QuickClean
call :sec "QUICK CLEAN"
call :DiskFree "Free space before"
echo(
call :step "Clearing user TEMP"
call :CleanDir "%TEMP%"
if /I not "%TMP%"=="%TEMP%" call :CleanDir "%TMP%"
call :CleanDir "%LOCALAPPDATA%\Temp"
call :done
call :step "Clearing Recent items and jump lists"
del /f /s /q "%APPDATA%\Microsoft\Windows\Recent\*" >nul 2>&1
del /f /s /q "%APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations\*" >nul 2>&1
del /f /s /q "%APPDATA%\Microsoft\Windows\Recent\CustomDestinations\*" >nul 2>&1
call :done
call :step "Clearing thumbnail and icon cache"
del /f /s /q /a "%LOCALAPPDATA%\Microsoft\Windows\Explorer\thumbcache_*.db" >nul 2>&1
del /f /s /q /a "%LOCALAPPDATA%\Microsoft\Windows\Explorer\iconcache_*.db" >nul 2>&1
call :done
call :step "Clearing crash dumps"
del /f /q "%LOCALAPPDATA%\CrashDumps\*" >nul 2>&1
call :done
echo(
call :DiskFree "Free space after"
call :ok "Quick clean complete."
call :anykey
exit /b
:Do_DeepClean
call :sec "DEEP CLEAN"
call :warn "Touches system caches and logs. Needs a moment."
call :Confirm "Run deep clean now?"
if errorlevel 1 ( call :info "Cancelled." & call :anykey & exit /b )
echo(
call :DiskFree "Free space before"
echo(
call :step "Clearing Windows TEMP"
call :CleanDir "%WINDIR%\Temp"
call :done
call :step "Clearing Prefetch"
del /f /q "%WINDIR%\Prefetch\*" >nul 2>&1
call :done
call :step "Clearing memory dumps"
del /f /q "%WINDIR%\MEMORY.DMP" >nul 2>&1
del /f /s /q "%WINDIR%\Minidump\*" >nul 2>&1
call :done
call :step "Clearing Windows Update cache"
net stop wuauserv >nul 2>&1
net stop bits >nul 2>&1
net stop dosvc >nul 2>&1
call :CleanDir "%WINDIR%\SoftwareDistribution\Download"
net start wuauserv >nul 2>&1
net start bits >nul 2>&1
net start dosvc >nul 2>&1
call :done
call :step "Clearing Delivery Optimization cache"
powershell -NoProfile -Command "Delete-DeliveryOptimizationCache -Force -ErrorAction SilentlyContinue" >nul 2>&1
call :done
call :step "Clearing error reports"
del /f /s /q "%PROGRAMDATA%\Microsoft\Windows\WER\*" >nul 2>&1
del /f /s /q "%LOCALAPPDATA%\Microsoft\Windows\WER\*" >nul 2>&1
call :done
call :step "Clearing servicing (CBS) logs"
net stop TrustedInstaller >nul 2>&1
del /f /s /q "%WINDIR%\Logs\CBS\*.log" >nul 2>&1
net start TrustedInstaller >nul 2>&1
call :done
call :step "Clearing font cache"
net stop FontCache >nul 2>&1
del /f /s /q "%WINDIR%\ServiceProfiles\LocalService\AppData\Local\FontCache\*" >nul 2>&1
del /f /q "%WINDIR%\System32\FNTCACHE.DAT" >nul 2>&1
net start FontCache >nul 2>&1
call :done
echo(
call :DiskFree "Free space after"
call :ok "Deep clean complete."
call :anykey
exit /b
:Do_RecycleBin
call :sec "EMPTY RECYCLE BIN"
call :Confirm "Permanently empty the Recycle Bin?"
if errorlevel 1 ( call :info "Cancelled." & call :anykey & exit /b )
echo(
call :step "Emptying Recycle Bin"
powershell -NoProfile -Command "Clear-RecycleBin -Force -ErrorAction SilentlyContinue" >nul 2>&1
call :done
call :ok "Recycle Bin emptied."
call :anykey
exit /b
:Do_BrowserClean
call :sec "CLEAN BROWSER CACHES"
call :warn "Close your browsers first. Cookies, history and passwords are NOT touched."
call :Confirm "Clean Chrome / Edge / Firefox caches?"
if errorlevel 1 ( call :info "Cancelled." & call :anykey & exit /b )
echo(
call :step "Chrome cache"
call :CleanDir "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Cache"
call :done
call :step "Edge cache"
call :CleanDir "%LOCALAPPDATA%\Microsoft\Edge\User Data\Default\Cache"
call :done
call :step "Firefox cache"
for /d %%P in ("%LOCALAPPDATA%\Mozilla\Firefox\Profiles\*") do call :CleanDir "%%P\cache2"
call :done
call :ok "Browser caches cleaned."
call :anykey
exit /b
:Do_FullClean
call :sec "FULL CLEAN"
call :warn "Runs Quick + Deep + Recycle Bin + Browser caches."
call :Confirm "Start a full clean?"
if errorlevel 1 ( call :info "Cancelled." & call :anykey & exit /b )
call :DiskFree "Free space before"
echo(
call :step "Clearing user temp and caches"
call :CleanDir "%TEMP%"
if /I not "%TMP%"=="%TEMP%" call :CleanDir "%TMP%"
call :CleanDir "%LOCALAPPDATA%\Temp"
del /f /s /q "%APPDATA%\Microsoft\Windows\Recent\*" >nul 2>&1
del /f /s /q /a "%LOCALAPPDATA%\Microsoft\Windows\Explorer\thumbcache_*.db" >nul 2>&1
del /f /q "%LOCALAPPDATA%\CrashDumps\*" >nul 2>&1
call :done
call :step "Clearing Windows temp and dumps"
call :CleanDir "%WINDIR%\Temp"
del /f /q "%WINDIR%\Prefetch\*" >nul 2>&1
del /f /q "%WINDIR%\MEMORY.DMP" >nul 2>&1
del /f /s /q "%PROGRAMDATA%\Microsoft\Windows\WER\*" >nul 2>&1
call :done
call :step "Clearing Windows Update cache"
net stop wuauserv >nul 2>&1
net stop bits >nul 2>&1
call :CleanDir "%WINDIR%\SoftwareDistribution\Download"
net start wuauserv >nul 2>&1
net start bits >nul 2>&1
powershell -NoProfile -Command "Delete-DeliveryOptimizationCache -Force -ErrorAction SilentlyContinue" >nul 2>&1
call :done
call :step "Clearing browser caches"
call :CleanDir "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Cache"
call :CleanDir "%LOCALAPPDATA%\Microsoft\Edge\User Data\Default\Cache"
call :done
call :step "Emptying Recycle Bin"
powershell -NoProfile -Command "Clear-RecycleBin -Force -ErrorAction SilentlyContinue" >nul 2>&1
call :done
echo(
call :DiskFree "Free space after"
call :ok "Full clean complete."
call :anykey
exit /b
:Do_DiskSpace
call :sec "DISK SPACE"
powershell -NoProfile -Command "Get-CimInstance Win32_LogicalDisk -Filter 'DriveType=3' | ForEach-Object { ' {0} {1,7:N1} GB free / {2,7:N1} GB total' -f $_.DeviceID, ($_.FreeSpace/1GB), ($_.Size/1GB) }"
call :anykey
exit /b
:Do_DiskCleanup
call :sec "WINDOWS DISK CLEANUP"
call :info "Opening the built-in Disk Cleanup dialog..."
cleanmgr /d %SystemDrive%
call :anykey
exit /b
:Do_StoreReset
call :sec "RESET MICROSOFT STORE CACHE"
call :info "Resetting the Store cache (a Store window may open)..."
wsreset.exe
call :ok "Store cache reset."
call :anykey
exit /b
:: ===================================================================
:: NETWORK TOOLS
:: ===================================================================
:NETWORK
cls
call :BannerSmall
echo(
echo %MAG% == %WHITE%NETWORK TOOLS %MAG%==%R%
call :hr
echo(
echo %MAG%[1]%R% %WHITE%Flush DNS Cache%R%
echo %MAG%[2]%R% %WHITE%Release / Renew IP%R%
echo %MAG%[3]%R% %WHITE%Reset Winsock / TCP-IP %GRAY%(reboot needed)%R%
echo %MAG%[4]%R% %WHITE%Show IP Configuration%R%
echo %MAG%[5]%R% %WHITE%Show Public IP%R%
echo %MAG%[6]%R% %WHITE%Ping Test%R%
echo %MAG%[7]%R% %WHITE%Traceroute%R%
echo %MAG%[8]%R% %WHITE%Set DNS Server %GRAY%(Cloudflare / Google / Auto)%R%
echo %MAG%[9]%R% %WHITE%Show Saved Wi-Fi Passwords%R%
echo %MAG%[10]%R% %WHITE%Active Connections %GRAY%(netstat)%R%
echo(
echo %GRAY%[B] Back%R%
echo(
call :hr
set "sel="
set /p "sel=%PINK% Choose an option:%R% "
if "%sel%"=="1" call :Do_FlushDNS
if "%sel%"=="2" call :Do_RenewIP
if "%sel%"=="3" call :Do_ResetStack
if "%sel%"=="4" call :Do_IPConfig
if "%sel%"=="5" call :Do_PublicIP
if "%sel%"=="6" call :Do_Ping
if "%sel%"=="7" call :Do_Trace
if "%sel%"=="8" call :Do_SetDNS
if "%sel%"=="9" call :Do_WifiPass
if "%sel%"=="10" call :Do_Netstat
if /I "%sel%"=="B" goto MAIN
goto NETWORK
:Do_FlushDNS
call :sec "FLUSH DNS CACHE"
ipconfig /flushdns
call :ok "DNS resolver cache cleared."
call :anykey
exit /b
:Do_RenewIP
call :sec "RELEASE / RENEW IP"
call :warn "Your connection drops briefly during renew."
call :step "Releasing"
ipconfig /release >nul 2>&1
call :done
call :step "Flushing DNS"
ipconfig /flushdns >nul 2>&1
call :done
call :step "Renewing"
ipconfig /renew >nul 2>&1
call :done
call :ok "IP address renewed."
call :anykey
exit /b
:Do_ResetStack
call :sec "RESET WINSOCK / TCP-IP"
call :warn "A restart is required. VPN/proxy tools may need reconfiguring."
call :Confirm "Reset the network stack now?"
if errorlevel 1 ( call :info "Cancelled." & call :anykey & exit /b )
netsh winsock reset
netsh int ip reset
netsh int ipv6 reset
call :ok "Network stack reset. Please reboot."
call :anykey
exit /b
:Do_IPConfig
call :sec "IP CONFIGURATION"
ipconfig /all
call :anykey
exit /b
:Do_PublicIP
call :sec "PUBLIC IP"
call :info "This contacts an external service (api.ipify.org)."
echo(
call :step "Looking up public IP"
set "PUBIP="
for /f "usebackq delims=" %%i in (`curl -s https://api.ipify.org 2^>nul`) do set "PUBIP=%%i"
if not defined PUBIP for /f "usebackq delims=" %%i in (`powershell -NoProfile -Command "(Invoke-RestMethod 'https://api.ipify.org')" 2^>nul`) do set "PUBIP=%%i"
call :done
echo(
if defined PUBIP (
echo %MAG%Public IP:%R% %WHITE%!PUBIP!%R%
) else (
call :err "Could not reach the internet."
)
call :anykey
exit /b
:Do_Ping
call :sec "PING TEST"
set "host="
set /p "host=%PINK% Host to ping %GRAY%(default 1.1.1.1):%R% "
if not defined host set "host=1.1.1.1"
echo(
ping -n 4 %host%
call :anykey
exit /b
:Do_Trace
call :sec "TRACEROUTE"
set "thost="
set /p "thost=%PINK% Host to trace %GRAY%(default 1.1.1.1):%R% "
if not defined thost set "thost=1.1.1.1"
echo(
tracert -d %thost%
call :anykey
exit /b
:Do_SetDNS
call :sec "SET DNS SERVER"
echo %MAG%Available network adapters:%R%
netsh interface show interface
echo(
set "adap="
set /p "adap=%PINK% Adapter name (e.g. Ethernet / Wi-Fi):%R% "
if not defined adap ( call :info "Cancelled." & call :anykey & exit /b )
echo(
echo %MAG%[1]%R% %WHITE%Cloudflare%R% %GRAY%1.1.1.1 / 1.0.0.1%R%
echo %MAG%[2]%R% %WHITE%Google%R% %GRAY%8.8.8.8 / 8.8.4.4%R%
echo %MAG%[3]%R% %WHITE%Automatic%R% %GRAY%(DHCP / revert)%R%
echo(
set "dc="
set /p "dc=%PINK% Choose:%R% "
if "%dc%"=="1" (
netsh interface ip set dns name="%adap%" static 1.1.1.1 primary
netsh interface ip add dns name="%adap%" 1.0.0.1 index=2
call :ok "DNS set to Cloudflare on %adap%."
) else if "%dc%"=="2" (
netsh interface ip set dns name="%adap%" static 8.8.8.8 primary
netsh interface ip add dns name="%adap%" 8.8.4.4 index=2
call :ok "DNS set to Google on %adap%."
) else if "%dc%"=="3" (
netsh interface ip set dns name="%adap%" dhcp
call :ok "DNS reset to automatic on %adap%."
) else (
call :info "Cancelled."
)
call :anykey
exit /b
:Do_WifiPass
call :sec "SAVED WI-FI PASSWORDS"
call :info "Passwords for networks saved on THIS PC. Keep them private."
echo(
:: Profiles are exported as XML and read by tag name. Scraping
:: "netsh wlan show" output would only work on English Windows,
:: since those field labels are translated.
set "WLDIR=%TEMP%\SpotX-WLAN"
set "WLTXT=%TEMP%\SpotX-WLAN.txt"
rd /s /q "%WLDIR%" >nul 2>&1
mkdir "%WLDIR%" >nul 2>&1
netsh wlan export profile key=clear folder="%WLDIR%" >nul 2>&1
powershell -NoProfile -Command "Get-ChildItem -Path '%WLDIR%\*.xml' -ErrorAction SilentlyContinue | ForEach-Object { $x=[xml](Get-Content -Raw -LiteralPath $_.FullName); $k=$x.WLANProfile.MSM.security.sharedKey.keyMaterial; if (-not $k) { $k='(open network)' }; '{0}|{1}' -f $x.WLANProfile.name,$k }" > "%WLTXT%" 2>nul
set "WLEMPTY="
for %%S in ("%WLTXT%") do if %%~zS EQU 0 set "WLEMPTY=1"
:: Printed with delayed expansion switched OFF: an SSID containing "!"
:: (FRITZ!Box and friends) would otherwise be swallowed mid-line.
setlocal DisableDelayedExpansion
for /f "usebackq tokens=1,* delims=|" %%A in ("%WLTXT%") do (
echo %MAG%SSID:%R% %WHITE%%%A%R% %GRAY%Key:%R% %GREEN%%%B%R%
)
endlocal
if defined WLEMPTY call :err "No saved Wi-Fi profiles found."
rd /s /q "%WLDIR%" >nul 2>&1
del /f /q "%WLTXT%" >nul 2>&1
call :anykey
exit /b
:Do_Netstat
call :sec "ACTIVE CONNECTIONS"
netstat -ano
call :anykey
exit /b
:: ===================================================================
:: SYSTEM INFO
:: ===================================================================
:SYSINFO
cls
call :BannerSmall
echo(
echo %MAG% == %WHITE%SYSTEM INFO %MAG%==%R%
call :hr
echo(
echo %MAG%[1]%R% %WHITE%Quick Overview%R%
echo %MAG%[2]%R% %WHITE%Disk Usage%R%
echo %MAG%[3]%R% %WHITE%Installed Software%R%
echo %MAG%[4]%R% %WHITE%Battery Report %GRAY%(laptops)%R%
echo %MAG%[5]%R% %WHITE%System Uptime%R%
echo %MAG%[6]%R% %WHITE%Full Report to Desktop%R%
echo(
echo %GRAY%[B] Back%R%
echo(
call :hr
set "sel="
set /p "sel=%PINK% Choose an option:%R% "
if "%sel%"=="1" call :Do_Overview
if "%sel%"=="2" call :Do_DiskSpace
if "%sel%"=="3" call :Do_Software
if "%sel%"=="4" call :Do_Battery
if "%sel%"=="5" call :Do_Uptime
if "%sel%"=="6" call :Do_Report
if /I "%sel%"=="B" goto MAIN
goto SYSINFO
:Do_Overview
call :sec "QUICK OVERVIEW"
call :info "Gathering system information..."
echo(
echo %MAG%Operating System%R%
:: Queried through CIM: systeminfo's field labels are translated, so
:: filtering its output with English strings prints nothing on a
:: non-English Windows.
powershell -NoProfile -Command "$os=Get-CimInstance Win32_OperatingSystem; $cs=Get-CimInstance Win32_ComputerSystem; ' Name: ' + $os.Caption; ' Version: ' + $os.Version + ' (Build ' + $os.BuildNumber + ')'; ' Architecture: ' + $os.OSArchitecture; ' Manufacturer: ' + $cs.Manufacturer; ' Model: ' + $cs.Model; ' Boot time: ' + $os.LastBootUpTime" 2>nul
echo(
echo %MAG%Processor%R%
powershell -NoProfile -Command "' ' + (Get-CimInstance Win32_Processor).Name" 2>nul
echo(
echo %MAG%Memory%R%
powershell -NoProfile -Command "' {0:N1} GB total' -f ((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory/1GB)" 2>nul
echo(
echo %MAG%Graphics%R%
powershell -NoProfile -Command "Get-CimInstance Win32_VideoController | ForEach-Object { ' ' + $_.Name }" 2>nul
call :anykey
exit /b
:Do_Software
call :sec "INSTALLED SOFTWARE"
powershell -NoProfile -Command "Get-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*','HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' -ErrorAction SilentlyContinue | Where-Object DisplayName | Select-Object -ExpandProperty DisplayName | Sort-Object -Unique"
call :anykey
exit /b
:Do_Battery
call :sec "BATTERY REPORT"
set "BREP=%USERPROFILE%\Desktop\SpotX-Battery-Report.html"
powercfg /batteryreport /output "%BREP%" >nul 2>&1
if exist "%BREP%" (
call :ok "Saved to Desktop: SpotX-Battery-Report.html"
start "" "%BREP%"
) else (
call :err "No battery detected or report failed."
)
call :anykey
exit /b
:Do_Uptime
call :sec "SYSTEM UPTIME"
powershell -NoProfile -Command "$os=Get-CimInstance Win32_OperatingSystem; $u=(Get-Date)-$os.LastBootUpTime; ' Up for {0} days, {1} hours, {2} minutes' -f $u.Days,$u.Hours,$u.Minutes; ' Last boot: ' + $os.LastBootUpTime"
call :anykey
exit /b
:Do_Report
call :sec "FULL SYSTEM REPORT"
set "REP=%USERPROFILE%\Desktop\SpotX-System-Report.txt"
call :step "Collecting system information"
( echo SpotX Multitool - System Report & echo Generated: %date% %time% & echo. & echo ===== SYSTEMINFO ===== & systeminfo & echo. & echo ===== DISKS ===== & powershell -NoProfile -Command "Get-CimInstance Win32_LogicalDisk -Filter 'DriveType=3' | Select-Object DeviceID,@{n='Size_GB';e={[math]::Round($_.Size/1GB,1)}},@{n='Free_GB';e={[math]::Round($_.FreeSpace/1GB,1)}} | Format-Table -Auto" & echo. & echo ===== NETWORK ===== & ipconfig /all ) > "%REP%" 2>&1
call :done
call :ok "Saved to Desktop: SpotX-System-Report.txt"
start "" notepad "%REP%"
call :anykey
exit /b
:: ===================================================================
:: SYSTEM REPAIR
:: ===================================================================
:REPAIR
cls
call :BannerSmall
echo(
echo %MAG% == %WHITE%SYSTEM REPAIR %MAG%==%R%
call :hr
echo(
echo %MAG%[1]%R% %WHITE%SFC Scan %GRAY%(scan + repair system files)%R%
echo %MAG%[2]%R% %WHITE%DISM Restore Health%R%
echo %MAG%[3]%R% %WHITE%Check Disk %GRAY%(schedule on reboot)%R%
echo %MAG%[4]%R% %WHITE%Reset Windows Update%R%
echo %MAG%[5]%R% %WHITE%Restart Explorer%R%
echo %MAG%[6]%R% %WHITE%Full Repair %GRAY%(DISM + SFC)%R%
echo(
echo %GRAY%[B] Back%R%
echo(
call :hr
set "sel="
set /p "sel=%PINK% Choose an option:%R% "
if "%sel%"=="1" call :Do_SFC
if "%sel%"=="2" call :Do_DISM
if "%sel%"=="3" call :Do_Chkdsk
if "%sel%"=="4" call :Do_ResetWU
if "%sel%"=="5" call :Do_Explorer
if "%sel%"=="6" call :Do_FullRepair
if /I "%sel%"=="B" goto MAIN
goto REPAIR
:Do_SFC
call :sec "SFC SCAN"
call :info "This can take several minutes. Please wait..."
echo(
sfc /scannow
call :ok "SFC finished."
call :anykey
exit /b
:Do_DISM
call :sec "DISM RESTORE HEALTH"
call :info "This can take several minutes and needs internet."
echo(
DISM /Online /Cleanup-Image /RestoreHealth
call :ok "DISM finished."
call :anykey
exit /b
:Do_Chkdsk
call :sec "CHECK DISK"
call :info "Read-only scan of %SystemDrive%. Nothing is changed yet."
echo(
chkdsk %SystemDrive%
echo(
call :warn "A repair pass cannot run while Windows is using the drive."
call :Confirm "Schedule a full repair for %SystemDrive% on next boot?"
if errorlevel 1 ( call :info "Skipped. No repair scheduled." & call :anykey & exit /b )
:: Marks the volume dirty so autochk repairs it at boot. Piping "Y" into
:: chkdsk /f only works on English Windows, where the prompt accepts Y.
fsutil dirty set %SystemDrive%
if errorlevel 1 (
call :err "Could not schedule the repair."
) else (
call :ok "Repair scheduled. It runs at the next restart and may take a while."
)
call :anykey
exit /b
:Do_ResetWU
call :sec "RESET WINDOWS UPDATE"
call :info "Folders are renamed, not deleted, so this is reversible."
call :Confirm "Reset Windows Update components?"
if errorlevel 1 ( call :info "Cancelled." & call :anykey & exit /b )
echo(
call :step "Stopping services"
net stop wuauserv >nul 2>&1
net stop cryptSvc >nul 2>&1
net stop bits >nul 2>&1
net stop msiserver >nul 2>&1
call :done
call :step "Resetting cache folders"
rd /s /q "%WINDIR%\SoftwareDistribution.old" >nul 2>&1
rd /s /q "%WINDIR%\System32\catroot2.old" >nul 2>&1
ren "%WINDIR%\SoftwareDistribution" SoftwareDistribution.old >nul 2>&1
ren "%WINDIR%\System32\catroot2" catroot2.old >nul 2>&1
call :done
call :step "Starting services"
net start wuauserv >nul 2>&1
net start cryptSvc >nul 2>&1
net start bits >nul 2>&1
net start msiserver >nul 2>&1
call :done
call :ok "Windows Update components reset."
call :anykey
exit /b
:Do_Explorer
call :sec "RESTART EXPLORER"
call :step "Restarting explorer.exe"
taskkill /f /im explorer.exe >nul 2>&1
start "" explorer.exe
call :done
call :ok "Explorer restarted."
call :anykey
exit /b
:Do_FullRepair
call :sec "FULL REPAIR"
call :info "Running DISM, then SFC. This takes a while..."
echo(
DISM /Online /Cleanup-Image /RestoreHealth
echo(
sfc /scannow
call :ok "Full repair finished."
call :anykey
exit /b
:: ===================================================================
:: OPTIMIZE
:: ===================================================================
:OPTIMIZE
cls
call :BannerSmall
echo(
echo %MAG% == %WHITE%OPTIMIZE %MAG%==%R%
call :hr
echo(
echo %MAG%[1]%R% %WHITE%List Startup Programs%R%
echo %MAG%[2]%R% %WHITE%Power Plan: High Performance%R%
echo %MAG%[3]%R% %WHITE%Power Plan: Balanced%R%
echo %MAG%[4]%R% %WHITE%Enable Ultimate Performance%R%
echo %MAG%[5]%R% %WHITE%Visual Effects: Best Performance%R%
echo %MAG%[6]%R% %WHITE%Visual Effects: Restore Default%R%
echo %MAG%[7]%R% %WHITE%Privacy: Disable Telemetry %GRAY%(reversible)%R%
echo %MAG%[8]%R% %WHITE%Privacy: Enable Telemetry%R%
echo(
echo %GRAY%[B] Back%R%
echo(
call :hr
set "sel="
set /p "sel=%PINK% Choose an option:%R% "
if "%sel%"=="1" call :Do_Startup
if "%sel%"=="2" call :Do_HighPerf
if "%sel%"=="3" call :Do_Balanced
if "%sel%"=="4" call :Do_Ultimate
if "%sel%"=="5" call :Do_VfxPerf
if "%sel%"=="6" call :Do_VfxDefault
if "%sel%"=="7" call :Do_TelemOff
if "%sel%"=="8" call :Do_TelemOn
if /I "%sel%"=="B" goto MAIN
goto OPTIMIZE
:Do_Startup
call :sec "STARTUP PROGRAMS"
echo %MAG%HKLM Run%R%
reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" 2>nul
echo(
echo %MAG%HKCU Run%R%
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" 2>nul
echo(
echo %MAG%Startup Folder%R%
dir /b "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup" 2>nul
call :anykey
exit /b
:Do_HighPerf
call :sec "POWER PLAN: HIGH PERFORMANCE"
call :warn "Raises power draw and heat. Use Balanced on battery."
powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
call :ok "Switched to High Performance."
call :anykey
exit /b
:Do_Balanced
call :sec "POWER PLAN: BALANCED"
powercfg /setactive 381b4222-f694-41f0-9685-ff5bb260df2e
call :ok "Switched to Balanced."
call :anykey
exit /b
:Do_Ultimate
call :sec "ULTIMATE PERFORMANCE"
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 >nul 2>&1
powercfg /setactive e9a42b02-d5df-448d-aa00-03f14749eb61
call :ok "Ultimate Performance enabled (if supported)."
call :anykey
exit /b
:Do_VfxPerf
call :sec "VISUAL EFFECTS: BEST PERFORMANCE"
call :Confirm "Set Windows visuals to best performance?"
if errorlevel 1 ( call :info "Cancelled." & call :anykey & exit /b )
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" /v VisualFXSetting /t REG_DWORD /d 2 /f >nul
call :ok "Set to best performance. Restart Explorer to apply."
call :anykey
exit /b
:Do_VfxDefault
call :sec "VISUAL EFFECTS: RESTORE DEFAULT"
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" /v VisualFXSetting /t REG_DWORD /d 0 /f >nul
call :ok "Restored to Windows default."
call :anykey
exit /b
:Do_TelemOff
call :sec "PRIVACY: DISABLE TELEMETRY"
call :warn "This is a privacy tweak, not a speed boost. Fully reversible via option 8."
call :Confirm "Disable the DiagTrack telemetry service?"
if errorlevel 1 ( call :info "Cancelled." & call :anykey & exit /b )
sc stop DiagTrack >nul 2>&1
sc config DiagTrack start=disabled >nul 2>&1
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f >nul
call :ok "Telemetry disabled."
call :anykey
exit /b
:Do_TelemOn
call :sec "PRIVACY: ENABLE TELEMETRY"
sc config DiagTrack start=auto >nul 2>&1
sc start DiagTrack >nul 2>&1
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /f >nul 2>&1
call :ok "Telemetry re-enabled (Windows default)."
call :anykey
exit /b
:: ===================================================================
:: SECURITY (defensive)
:: ===================================================================
:SECURITY
cls
call :BannerSmall
echo(
echo %MAG% == %WHITE%SECURITY %MAG%==%R%
call :hr
echo(
echo %MAG%[1]%R% %WHITE%Windows Defender Quick Scan%R%
echo %MAG%[2]%R% %WHITE%Update Defender Signatures%R%
echo %MAG%[3]%R% %WHITE%Defender Status%R%
echo %MAG%[4]%R% %WHITE%Firewall Status%R%
echo %MAG%[5]%R% %WHITE%Listening Ports%R%
echo %MAG%[6]%R% %WHITE%Audit Startup / Persistence%R%
echo(
echo %GRAY%[B] Back%R%
echo(
call :hr
set "sel="
set /p "sel=%PINK% Choose an option:%R% "
if "%sel%"=="1" call :Do_DefScan
if "%sel%"=="2" call :Do_DefUpdate
if "%sel%"=="3" call :Do_DefStatus
if "%sel%"=="4" call :Do_Firewall
if "%sel%"=="5" call :Do_Ports
if "%sel%"=="6" call :Do_Persist
if /I "%sel%"=="B" goto MAIN
goto SECURITY
:Do_DefScan
call :sec "DEFENDER QUICK SCAN"
call :info "Starting a quick scan. This can take a few minutes."
echo(
powershell -NoProfile -Command "Start-MpScan -ScanType QuickScan" 2>nul
call :ok "Quick scan finished."
call :anykey
exit /b
:Do_DefUpdate
call :sec "UPDATE DEFENDER SIGNATURES"
powershell -NoProfile -Command "Update-MpSignature" 2>nul
call :ok "Signature update requested."
call :anykey
exit /b
:Do_DefStatus
call :sec "DEFENDER STATUS"
powershell -NoProfile -Command "Get-MpComputerStatus | Select-Object AMRunningMode,RealTimeProtectionEnabled,AntivirusSignatureLastUpdated,QuickScanEndTime | Format-List" 2>nul
call :anykey
exit /b
:Do_Firewall
call :sec "FIREWALL STATUS"
netsh advfirewall show allprofiles state
call :anykey
exit /b
:Do_Ports
call :sec "LISTENING PORTS"
netstat -ano | findstr LISTENING
call :anykey
exit /b
:Do_Persist
call :sec "AUDIT STARTUP / PERSISTENCE"
call :info "Read-only. Review these entries yourself; nothing is changed."
echo(
echo %MAG%HKLM Run%R%
reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" 2>nul
echo(
echo %MAG%HKCU Run%R%
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" 2>nul
echo(
echo %MAG%RunOnce%R%
reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce" 2>nul
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce" 2>nul
call :anykey
exit /b
:: ===================================================================
:: UTILITIES
:: ===================================================================
:UTIL
cls
call :BannerSmall
echo(
echo %MAG% == %WHITE%UTILITIES %MAG%==%R%
call :hr
echo(
echo %MAG%[1]%R% %WHITE%Create Restore Point%R%
echo %MAG%[2]%R% %WHITE%Open GodMode Panel%R%
echo %MAG%[3]%R% %WHITE%Edit Hosts File%R%
echo %MAG%[4]%R% %WHITE%Environment Info%R%
echo %MAG%[5]%R% %WHITE%Take Ownership of Folder%R%
echo(
echo %GRAY%[B] Back%R%
echo(
call :hr
set "sel="
set /p "sel=%PINK% Choose an option:%R% "
if "%sel%"=="1" call :Do_Restore
if "%sel%"=="2" call :Do_GodMode
if "%sel%"=="3" call :Do_Hosts
if "%sel%"=="4" call :Do_EnvInfo
if "%sel%"=="5" call :Do_TakeOwn
if /I "%sel%"=="B" goto MAIN
goto UTIL
:Do_Restore
call :sec "CREATE RESTORE POINT"
call :info "Enabling protection and creating a checkpoint..."
echo(
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" /v SystemRestorePointCreationFrequency /t REG_DWORD /d 0 /f >nul 2>&1
powershell -NoProfile -Command "Enable-ComputerRestore -Drive '%SystemDrive%\'; Checkpoint-Computer -Description 'SpotX Multitool' -RestorePointType 'MODIFY_SETTINGS'" 2>nul
call :ok "Restore point created."
call :anykey
exit /b
:Do_GodMode
call :sec "GODMODE PANEL"
set "GODDIR=%USERPROFILE%\Desktop\GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}"
if not exist "%GODDIR%" mkdir "%GODDIR%" >nul 2>&1
start "" "%GODDIR%"
call :ok "GodMode panel opened (also on your Desktop)."
call :anykey
exit /b
:Do_Hosts
call :sec "EDIT HOSTS FILE"
start "" notepad "%WINDIR%\System32\drivers\etc\hosts"
call :ok "Opened hosts file in Notepad."
call :anykey
exit /b
:Do_EnvInfo
call :sec "ENVIRONMENT INFO"
echo %MAG%User:%R% %WHITE%%USERNAME%%R%
echo %MAG%Computer:%R% %WHITE%%COMPUTERNAME%%R%
echo %MAG%Windows dir:%R% %WHITE%%WINDIR%%R%
echo %MAG%System drive:%R% %WHITE%%SystemDrive%%R%
echo %MAG%Processor:%R% %WHITE%%PROCESSOR_IDENTIFIER%%R%
echo %MAG%Cores:%R% %WHITE%%NUMBER_OF_PROCESSORS%%R%
echo %MAG%Temp:%R% %WHITE%%TEMP%%R%
call :anykey
exit /b
:Do_TakeOwn
call :sec "TAKE OWNERSHIP OF FOLDER"
call :warn "Changes ownership + permissions recursively. Only use on folders you own."
set "own="
set /p "own=%PINK% Full folder path:%R% "
if not defined own ( call :info "Cancelled." & call :anykey & exit /b )
:: Resolve to a full path first, so a relative path, forward slashes
:: or a trailing backslash cannot slip past the checks below.
for %%I in ("%own%") do set "own=%%~fI"
if "!own:~-1!"=="\" set "own=!own:~0,-1!"
if not exist "!own!\" ( call :err "That folder does not exist." & call :anykey & exit /b )
if "!own:~1!"==":" ( call :err "Refusing to touch a drive root." & call :anykey & exit /b )
set "OWNBAD="
for %%X in ("%WINDIR%" "%ProgramFiles%" "%ProgramFiles(x86)%" "%ProgramData%" "%SystemDrive%\Users") do (
if /I "!own!"=="%%~X" set "OWNBAD=1"
)
:: Also reject anything living inside a protected tree.
for %%X in ("%WINDIR%" "%ProgramFiles%" "%ProgramFiles(x86)%" "%ProgramData%") do (
if /I not "!own!"=="!own:%%~X\=!" set "OWNBAD=1"
)
if defined OWNBAD ( call :err "Refusing: that is a Windows system folder." & call :anykey & exit /b )
call :Confirm "Take ownership of !own! ?"
if errorlevel 1 ( call :info "Cancelled." & call :anykey & exit /b )
:: No /d switch: its answer letter is translated (German expects J),
:: so passing "y" makes takeown fail outright on a non-English Windows.
takeown /f "!own!" /r >nul 2>&1
icacls "!own!" /grant *S-1-5-32-544:F /t /c >nul 2>&1
call :ok "Ownership and full control granted to Administrators."
call :anykey
exit /b
:: ===================================================================
:: ABOUT
:: ===================================================================
:ABOUT
cls
call :LogoStatic
echo(
call :hr
echo(
echo %WHITE%%APP_NAME%%R% %GRAY%v%APP_VER%%R%
echo %GRAY%A free, open-source Windows multitool and cleaner.%R%
echo(
echo %MAG%GitHub:%R% %WHITE%github.com/Azad0008/SpotX-Multitool%R%
echo %MAG%License:%R% %WHITE%MIT%R%
echo %MAG%Author:%R% %WHITE%SpotX%R%
echo(
echo %AMBER%Disclaimer:%R% %GRAY%Some actions are irreversible. Review the%R%