-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.bat
70 lines (58 loc) · 3.28 KB
/
main.bat
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
@echo off
:: Check if running as administrator
net session >nul 2>&1
if %errorLevel% == 0 (
echo Running with administrator privileges...
) else (
echo This script requires administrator privileges. Please run as administrator and try again.
pause
exit
)
:: Check internet connection and speed
echo Checking internet connection and speed...
:check_internet
powershell.exe -command "$ping = Test-Connection google.com -Count 1 -ErrorAction SilentlyContinue; if($ping){Write-Host 'Internet is connected'; $speedtest = Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py' -UseBasicParsing; python -c $speedtest.content | Out-File -FilePath speedtest.txt; Get-Content -Path speedtest.txt; Remove-Item -Path speedtest.txt;} else {Write-Host -ForegroundColor Red 'CONNECT TO INTERNET'; Start-Sleep -Seconds 10; goto check_internet;}"
:: Install software using Chocolatey from apps.txt file
echo Installing software from apps.txt...
for /F "usebackq delims=" %%i in ("apps.txt") do choco install "%%i" -y
:: Update Windows
echo Checking for Windows updates...
powershell.exe -command "Get-WindowsUpdate -Install -AcceptAll"
echo Windows is up-to-date.
:: Create a backup of important files
echo Creating a backup of Documents folder...
xcopy "C:\Users\username\Documents" "D:\Backup\Documents" /e /i /h
:: Set up a system restore point
echo Creating a system restore point...
powershell.exe -command "Checkpoint-Computer -Description 'System Restore Point'"
:: Optimize your system
echo Optimizing your system...
echo Disabling unnecessary startup programs...
powershell.exe -command "Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' -Name 'ProgramName' -Value $null"
echo Defragmenting hard drive...
defrag c: /h /u /v
echo Running disk cleanup...
cleanmgr /sagerun:1
:: Secure your system
echo Securing your system...
echo Enabling Firewall...
netsh advfirewall set allprofiles state on
echo Configuring User Account Control (UAC) settings...
powershell.exe -command "Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name 'EnableLUA' -Value 1"
echo Setting up strong passwords for user accounts...
net user Administrator Password123
:: Set custom cursors as default
echo Setting custom cursors as default...
reg add "HKCU\Control Panel\Cursors" /v Arrow /t REG_SZ /d "C:\Windows\Cursors\my_arrow.cur" /f
reg add "HKCU\Control Panel\Cursors" /v Wait /t REG_SZ /d "C:\Windows\Cursors\my_wait.cur" /f
reg add "HKCU\Control Panel\Cursors" /v AppStarting /t REG_SZ /d "C:\Windows\Cursors\my_appstarting.cur" /f
reg add "HKCU\Control Panel\Cursors" /v Help /t REG_SZ /d "C:\Windows\Cursors\my_help.cur" /f
reg add "HKCU\Control Panel\Cursors" /v No /t REG_SZ /d "C:\Windows\Cursors\my_no.cur" /f
reg add "HKCU\Control Panel\Cursors" /v NWPen /t REG_SZ /d "C:\Windows\Cursors\my_nwpen.cur" /f
reg add "HKCU\Control Panel\Cursors" /v SizeNS /t REG_SZ /d "C:\Windows\Cursors\my_sizens.cur" /f
reg add "HKCU\Control Panel\Cursors" /v SizeWE /t REG_SZ /d "C:\Windows\Cursors\my_sizewe.cur" /f
reg add "HKCU\Control Panel\Cursors" /v UpArrow /t REG_SZ /d "C:\Windows\Cursors\my_uparrow.cur" /f
reg add "HKCU\Control Panel\Cursors" /v IBeam /t REG_SZ /d "C:\Windows\Cursors\my_ibeam.cur" /f
:: Done
echo All tasks completed.
pause