win10-prep

Batch script to tweak Windows 10 to a more usable form
Log | Files | Refs

win10-prep.bat (32652B)


      1 
      2 rem intro
      3 @echo off
      4 title Windows 10 Prep Script
      5 pushd "%~dp0"
      6 cls
      7 echo.
      8 echo  :: Windows 10 Prep Script
      9 echo.
     10 echo     Please review and be aware of what this script does before running it.
     11 echo     There is no uninstaller, and backups won't be created.
     12 echo.
     13 rem check permissions
     14 net session >nul 2>&1
     15 if %errorLevel% == 0 (
     16     echo     You won't be prompted any further.
     17     echo     Press [enter] to begin.
     18     echo.
     19     set /p=
     20 ) else (
     21     echo     This script requires administrator rights.
     22     echo     Press any key to exit
     23     pause >nul
     24     exit
     25 )
     26 
     27 rem Process
     28 <NUL set /p=:: System Tweaks...
     29 call :system_tweaks > nul
     30 echo. done
     31 <NUL set /p=:: Registry Tweaks...
     32 call :registry_tweaks > nul
     33 echo. done
     34 <NUL set /p=:: Removing Software...
     35 call :remove_software > nul
     36 echo. done
     37 <NUL set /p=:: Installing Software...
     38 call :install_software > nul
     39 echo. done
     40 <NUL set /p=:: Clean Up...
     41 call :cleanup > nul
     42 echo. done
     43 
     44 rem complete
     45 echo.
     46 echo  :: Script complete
     47 echo.
     48 echo     Restart whenever you fancy.
     49 echo     Press [enter] to exit.
     50 echo.
     51 set /p=
     52 :eof
     53 exit
     54 
     55 :system_tweaks
     56 rem enable f8 boot menu
     57 bcdedit /set {default} bootmenupolicy legacy
     58 rem enable admin account
     59 net user Administrator /active:yes
     60 rem label system drive
     61 label %systemdrive%System
     62 rem disable hibernation, removing hiberfil.sys
     63 powercfg -h off
     64 rem change ntp server addresses and resync time
     65 w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org"
     66 w32tm /resync /nowait
     67 rem don't require signin after wakeup
     68 powercfg /SETDCVALUEINDEX SCHEME_CURRENT SUB_NONE CONSOLELOCK 0
     69 powercfg /SETACVALUEINDEX SCHEME_CURRENT SUB_NONE CONSOLELOCK 0
     70 rem disable 8.3 names on root and strip existing values
     71 fsutil 8dot3name set %systemdrive% 1
     72 fsutil 8dot3name strip /s /v %systemdrive%
     73 exit /b %errorlevel%
     74 
     75 :registry_tweaks
     76 rem disable lock screen
     77 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Personalization" /v "NoLockScreen" /t REG_DWORD /d "1" /f
     78 rem maximum mouse speed
     79 reg add "HKCU\Control Panel\Mouse" /v "MouseSensitivity" /t REG_SZ /d "20" /f
     80 rem disable hiding of unused tray icons
     81 reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "EnableAutoTray" /t REG_DWORD /d 0 /f
     82 rem show hidden files in explorer
     83 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "Hidden" /t REG_DWORD /d 1 /f
     84 rem show file extensions in explorer
     85 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d "0" /f
     86 rem disable advertising maybe
     87 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v "Enabled" /t REG_DWORD /d "0" /f
     88 reg add "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v "Enabled" /t REG_DWORD /d "0" /f
     89 rem disable notification centre in tray
     90 reg add "HKCU\SOFTWARE\Policies\Microsoft\Windows\Explorer" /v "DisableNotificationCenter" /t REG_DWORD /d "1" /f
     91 rem disable action centre
     92 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\ImmersiveShell" /v "UseActionCenterExperience" /t REG_DWORD /d 0 /f
     93 rem open explorer to this pc instead of quick access
     94 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "LaunchTo" /t REG_DWORD /d "1" /f
     95 rem rename 'this pc' to 'computer'
     96 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" /ve /t REG_SZ /d "Computer" /f
     97 rem disable recent documents in quick access in explorer
     98 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /v "ShowRecent" /t REG_DWORD /d "0" /f
     99 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /v "ShowFrequent" /t REG_DWORD /d "0" /f
    100 rem fix photo viewer associations in ltsb
    101 reg add "HKCR\Applications\photoviewer.dll\shell\open" /v "MuiVerb" /t REG_SZ /d "@photoviewer.dll,-3043" /f
    102 reg add "HKCR\Applications\photoviewer.dll\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f
    103 reg add "HKCR\Applications\photoviewer.dll\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f
    104 reg add "HKCR\Applications\photoviewer.dll\shell\print\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f
    105 reg add "HKCR\Applications\photoviewer.dll\shell\print\DropTarget" /v "Clsid" /t REG_SZ /d "{60fd46de-f830-4894-a628-6fa81bc0190d}" /f
    106 for %%x in (bmp gif ico jpeg jpg png tiff) do reg add "HKCU\Software\Classes\.%%x" /ve /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f
    107 rem support win32calc if exists
    108 if exist %windir%\System32\win32calc.exe reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\calc.exe" /v "Debugger" /t REG_SZ /d "\"%SystemRoot%\System32\win32calc.exe\"" /f
    109 if exist %windir%\System32\win32calc.exe reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\calc.exe" /v "Debugger" /t REG_SZ /d "\"%SystemRoot%\System32\win32calc.exe\"" /f
    110 rem notepad file associations
    111 for %%x in (cfg conf cpp cue diff go json md nfo nfo-orig patch php ps1 sh srt toml yml) do reg add "HKCR\.%%x" /ve /t REG_SZ /d "txtfile" /f
    112 rem disable various services
    113 for %%x in (AppMgmt CscService DiagTrack dmwappushservice DoSvc DusmSvc HomeGroupListener HomeGroupProvider lfsvc PcaSvc ProtectedStorage RemoteRegistry SCardSvr SCPolicySvc seclogon Spooler WebClient wercplsupport WerSvc WMPNetworkSvc wscsvc WSearch) do reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%x" /v "Start" /t REG_DWORD /d "4" /f
    114 rem attempt to disable some online search 'features'
    115 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d "0" /f
    116 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowSearchToUseLocation" /t REG_DWORD /d "0" /f
    117 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchPrivacy" /t REG_DWORD /d "3" /f
    118 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchSafeSearch" /t REG_DWORD /d "3" /f
    119 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWeb" /t REG_DWORD /d "0" /f
    120 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWebOverMeteredConnections" /t REG_DWORD /d "0" /f
    121 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "DisableWebSearch" /t REG_DWORD /d "1" /f
    122 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "PreventRemoteQueries" /t REG_DWORD /d "1" /f
    123 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /ve /t REG_SZ /d "" /f
    124 rem rename computer name from unique gibberish to Username-PC
    125 reg add "HKCU\Volatile Environment" /v "LOGONSERVER" /t REG_SZ /d "\\%username%-PC" /f
    126 reg add "HKCU\Volatile Environment" /v "USERDOMAIN" /t REG_SZ /d "%username%-PC" /f
    127 reg add "HKCU\Volatile Environment" /v "USERDOMAIN_ROAMINGPROFILE" /t REG_SZ /d "%username%-PC" /f
    128 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Reliability" /v "LastComputerName" /t REG_SZ /d "%username%-PC" /f
    129 reg add "HKLM\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName" /v "ComputerName" /t REG_SZ /d "%username%-PC" /f
    130 reg add "HKLM\SYSTEM\ControlSet001\Control\ComputerName\ComputerName" /v "ComputerName" /t REG_SZ /d "%username%-PC" /f
    131 reg add "HKLM\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "Hostname" /t REG_SZ /d "%username%-PC" /f
    132 reg add "HKLM\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "NV Hostname" /t REG_SZ /d "%username%-PC" /f
    133 reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "Hostname" /t REG_SZ /d "%username%-PC" /f
    134 reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t REG_SZ /d "%username%-PC" /f
    135 rem default languages
    136 reg add "HKLM\SYSTEM\CurrentControlSet\Control\Nls\Language" /v "InstallLanguage" /t REG_SZ /d "0809" /f
    137 reg add "HKLM\SYSTEM\CurrentControlSet\Control\Nls\Language" /v "Default" /t REG_SZ /d "0809" /f
    138 rem add take ownership to context menu
    139 reg add "HKCR\*\shell\runas" /v "HasLUAShield" /t REG_SZ /d "" /f
    140 reg add "HKCR\*\shell\runas" /v "NoWorkingDirectory" /t REG_SZ /d "" /f
    141 reg add "HKCR\*\shell\runas" /ve /t REG_SZ /d "Take ownership" /f
    142 reg add "HKCR\*\shell\runas\command" /v "IsolatedCommand" /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" && icacls \"%%1\" /grant administrators:F" /f
    143 reg add "HKCR\*\shell\runas\command" /ve /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" && icacls \"%%1\" /grant administrators:F" /f
    144 reg add "HKCR\Directory\shell\runas" /v "HasLUAShield" /t REG_SZ /d "" /f
    145 reg add "HKCR\Directory\shell\runas" /v "NoWorkingDirectory" /t REG_SZ /d "" /f
    146 reg add "HKCR\Directory\shell\runas" /ve /t REG_SZ /d "Take ownership" /f
    147 reg add "HKCR\Directory\shell\runas\command" /v "IsolatedCommand" /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" /r /d y && icacls \"%%1\" /grant administrators:F /t" /f
    148 reg add "HKCR\Directory\shell\runas\command" /ve /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" /r /d y && icacls \"%%1\" /grant administrators:F /t" /f
    149 rem disable auto-detection of installers and updates to elevate
    150 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableInstallerDetection" /t REG_DWORD /d "0" /f
    151 rem enable auto completion in explorer
    152 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoComplete" /v "Append Completion" /t REG_SZ /d "yes" /f
    153 rem hide ' - shortcut' text on shortcuts
    154 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /v "link" /t REG_BINARY /d "00000000" /f
    155 rem show application names in taskbar
    156 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarGlomLevel" /t REG_DWORD /d "2" /f
    157 rem disable aero shake
    158 reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v "NoWindowMinimizingShortcuts" /t REG_DWORD /d "1" /f
    159 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "DisallowShaking" /t REG_DWORD /d "1" /f
    160 rem add control panel icon view to my computer
    161 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{21EC2020-3AEA-1069-A2DD-08002B30309D}" /f
    162 rem add recycle bin icon to my computer
    163 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{645FF040-5081-101B-9F08-00AA002F954E}" /f
    164 rem disable aggressive update reboot behaviour
    165 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v "ForcedReboot" /t REG_DWORD /d "0" /f
    166 rem hide all desktop icons
    167 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideIcons" /t REG_DWORD /d "1" /f
    168 rem hide task view icon in taskbar
    169 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d "0" /f
    170 rem hide search icon in taskbar
    171 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f
    172 rem hide cortana icon in taskbar
    173 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCortanaButton" /t REG_DWORD /d "0" /f
    174 rem small taskbar icon size
    175 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarSmallIcons" /t REG_DWORD /d "1" /f
    176 rem have a stab at disabling telemetry
    177 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d "0" /f
    178 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d "0" /f
    179 reg add "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d "0" /f
    180 rem windows updates directly from windows instead of local network
    181 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" /v "DODownloadMode" /t REG_DWORD /d "0" /f
    182 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" /v "DownloadMode" /t REG_DWORD /d "0" /f
    183 rem disable accessibility keys
    184 reg add "HKCU\Control Panel\Accessibility\StickyKeys" /v "Flags" /t REG_SZ /d "506" /f
    185 reg add "HKCU\Control Panel\Accessibility\Keyboard Response" /v "Flags" /t REG_SZ /d "122" /f
    186 reg add "HKCU\Control Panel\Accessibility\ToggleKeys" /v "Flags" /t REG_SZ /d "58" /f
    187 rem fixes "this folder is shared with other people" popup when files are created by cygwin
    188 reg delete "HKCR\Directory\shellex\CopyHookHandlers\Sharing" /f
    189 rem reduce menu show delay
    190 reg add "HKCU\Control Panel\Desktop" /v "MenuShowDelay" /t REG_SZ /d "75" /f
    191 rem auto close non-responding applications on shutdown
    192 reg add "HKCU\Control Panel\Desktop" /v "AutoEndTasks" /t REG_SZ /d "1" /f
    193 reg add "HKCU\Control Panel\Desktop" /v "HungAppTimeout" /t REG_SZ /d "1000" /f
    194 reg add "HKLM\SYSTEM\ControlSet001\Control" /v "WaitToKillServiceTimeout" /t REG_SZ /d "2000" /f
    195 reg add "HKLM\SYSTEM\ControlSet002\Control" /v "WaitToKillServiceTimeout" /t REG_SZ /d "2000" /f
    196 reg add "HKLM\SYSTEM\CurrentControlSet\Control" /v "WaitToKillServiceTimeout" /t REG_SZ /d "2000" /f
    197 rem disable system restore
    198 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore" /v "DisableConfig" /t REG_DWORD /d "1" /f
    199 rem disable animations
    200 reg add "HKCU\Control Panel\Desktop\WindowMetrics" /v MinAnimate /t REG_SZ /d 0 /f
    201 rem disable lock screen
    202 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Personalization" /v "NoLockScreen" /t REG_DWORD /d "1" /f
    203 rem enable dark theme
    204 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "EnableTransparency" /t REG_DWORD /d "1" /f
    205 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AppsUseLightTheme" /t REG_DWORD /d "0" /f
    206 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /t REG_DWORD /d "0" /f
    207 rem dark theme colour hightlight
    208 reg add "HKCU\Software\Microsoft\Windows\DWM" /v "ColorizationColor" /t REG_DWORD /d "3291315610" /f
    209 reg add "HKCU\Software\Microsoft\Windows\DWM" /v "ColorizationAfterglow" /t REG_DWORD /d "3291315610" /f
    210 reg add "HKCU\Software\Microsoft\Windows\DWM" /v "AccentColor" /t REG_DWORD /d "4288314669" /f
    211 rem blank desktop background
    212 reg add "HKCU\Control Panel\Desktop" /v "Wallpaper" /t REG_SZ /d "" /f
    213 reg add "HKCU\Control Panel\Colors" /v "Background" /t REG_SZ /d "76 74 72" /f
    214 rem blank login background
    215 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v "DisableLogonBackgroundImage" /t REG_DWORD /d "1" /f
    216 rem disable admin shares
    217 reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "AutoShareWks" /t REG_DWORD /d "0" /f
    218 rem allow access to guest shares
    219 reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d "1" /f
    220 rem minimise explorer ribbon by default, ugh what a mess
    221 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Ribbon" /v "QatItems" /t REG_BINARY /d "3c7369713a637573746f6d554920786d6c6e733a7369713d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f77696e646f77732f323030392f726962626f6e2f716174223e3c7369713a726962626f6e206d696e696d697a65643d2274727565223e3c7369713a71617420706f736974696f6e3d2230223e3c7369713a736861726564436f6e74726f6c733e3c7369713a636f6e74726f6c206964513d227369713a3136313238222076697369626c653d2266616c73652220617267756d656e743d223022202f3e3c7369713a636f6e74726f6c206964513d227369713a3136313239222076697369626c653d2266616c73652220617267756d656e743d223022202f3e3c7369713a636f6e74726f6c206964513d227369713a3132333532222076697369626c653d2266616c73652220617267756d656e743d223022202f3e3c7369713a636f6e74726f6c206964513d227369713a3132333834222076697369626c653d22747275652220617267756d656e743d223022202f3e3c7369713a636f6e74726f6c206964513d227369713a3132333336222076697369626c653d22747275652220617267756d656e743d223022202f3e3c7369713a636f6e74726f6c206964513d227369713a3132333537222076697369626c653d2266616c73652220617267756d656e743d223022202f3e3c2f7369713a736861726564436f6e74726f6c733e3c2f7369713a7161743e3c2f7369713a726962626f6e3e3c2f7369713a637573746f6d55493e" /f
    222 rem remap altgr key to lalt
    223 reg add "HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layout" /v "Scancode Map" /t REG_BINARY /d "000000000000000002000000380038e000000000" /f
    224 rem support redshift experimental builds
    225 reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM" /v "GdiIcmGammaRange" /t REG_DWORD /d "256" /f
    226 rem remove people icon in taskbar
    227 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" /v "PeopleBand" /t REG_DWORD /d "0" /f
    228 rem remove 3d objects folder
    229 reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" /f
    230 reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" /f
    231 rem disable win10 game bar
    232 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" /v "AppCaptureEnabled" /t REG_DWORD /d "0" /f
    233 reg add "HKCU\System\GameConfigStore" /v "GameDVR_Enabled" /t REG_DWORD /d "0" /f
    234 rem enable numlock on boot
    235 reg add "HKCU\Control Panel\Keyboard" /v "InitialKeyboardIndicators" /t REG_SZ /d "2" /f
    236 rem disable sound scheme
    237 reg add "HKCU\Control Panel\Sound" /v "Beep" /t REG_SZ /d "no" /f
    238 reg add "HKCU\AppEvents\Schemes" /ve /t REG_SZ /d ".None" /f
    239 reg add "HKCU\AppEvents\Schemes\Apps\.Default\.Default\.Current" /ve /t REG_SZ /d "" /f
    240 reg add "HKCU\AppEvents\Schemes\Apps\.Default\CriticalBatteryAlarm\.Current" /ve /t REG_SZ /d "" /f
    241 reg add "HKCU\AppEvents\Schemes\Apps\.Default\DeviceConnect\.Current" /ve /t REG_SZ /d "" /f
    242 reg add "HKCU\AppEvents\Schemes\Apps\.Default\DeviceDisconnect\.Current" /ve /t REG_SZ /d "" /f
    243 reg add "HKCU\AppEvents\Schemes\Apps\.Default\DeviceFail\.Current" /ve /t REG_SZ /d "" /f
    244 reg add "HKCU\AppEvents\Schemes\Apps\.Default\FaxBeep\.Current" /ve /t REG_SZ /d "" /f
    245 reg add "HKCU\AppEvents\Schemes\Apps\.Default\LowBatteryAlarm\.Current" /ve /t REG_SZ /d "" /f
    246 reg add "HKCU\AppEvents\Schemes\Apps\.Default\MailBeep\.Current" /ve /t REG_SZ /d "" /f
    247 reg add "HKCU\AppEvents\Schemes\Apps\.Default\MessageNudge\.Current" /ve /t REG_SZ /d "" /f
    248 reg add "HKCU\AppEvents\Schemes\Apps\.Default\Notification.Default\.Current" /ve /t REG_SZ /d "" /f
    249 reg add "HKCU\AppEvents\Schemes\Apps\.Default\Notification.IM\.Current" /ve /t REG_SZ /d "" /f
    250 reg add "HKCU\AppEvents\Schemes\Apps\.Default\Notification.Mail\.Current" /ve /t REG_SZ /d "" /f
    251 reg add "HKCU\AppEvents\Schemes\Apps\.Default\Notification.Proximity\.Current" /ve /t REG_SZ /d "" /f
    252 reg add "HKCU\AppEvents\Schemes\Apps\.Default\Notification.Reminder\.Current" /ve /t REG_SZ /d "" /f
    253 reg add "HKCU\AppEvents\Schemes\Apps\.Default\Notification.SMS\.Current" /ve /t REG_SZ /d "" /f
    254 reg add "HKCU\AppEvents\Schemes\Apps\.Default\ProximityConnection\.Current" /ve /t REG_SZ /d "" /f
    255 reg add "HKCU\AppEvents\Schemes\Apps\.Default\SystemAsterisk\.Current" /ve /t REG_SZ /d "" /f
    256 reg add "HKCU\AppEvents\Schemes\Apps\.Default\SystemExclamation\.Current" /ve /t REG_SZ /d "" /f
    257 reg add "HKCU\AppEvents\Schemes\Apps\.Default\SystemHand\.Current" /ve /t REG_SZ /d "" /f
    258 reg add "HKCU\AppEvents\Schemes\Apps\.Default\SystemNotification\.Current" /ve /t REG_SZ /d "" /f
    259 reg add "HKCU\AppEvents\Schemes\Apps\.Default\WindowsUAC\.Current" /ve /t REG_SZ /d "" /f
    260 reg add "HKCU\AppEvents\Schemes\Apps\sapisvr\DisNumbersSound\.current" /ve /t REG_SZ /d "" /f
    261 reg add "HKCU\AppEvents\Schemes\Apps\sapisvr\HubOffSound\.current" /ve /t REG_SZ /d "" /f
    262 reg add "HKCU\AppEvents\Schemes\Apps\sapisvr\HubOnSound\.current" /ve /t REG_SZ /d "" /f
    263 reg add "HKCU\AppEvents\Schemes\Apps\sapisvr\HubSleepSound\.current" /ve /t REG_SZ /d "" /f
    264 reg add "HKCU\AppEvents\Schemes\Apps\sapisvr\MisrecoSound\.current" /ve /t REG_SZ /d "" /f
    265 reg add "HKCU\AppEvents\Schemes\Apps\sapisvr\PanelSound\.current" /ve /t REG_SZ /d "" /f
    266 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\BootAnimation" /v "DisableStartupSound" /t REG_DWORD /d "1" /f
    267 rem disable wallpaper compression
    268 reg add "HKCU\Control Panel\Desktop" /v "JPEGImportQuality" /t REG_DWORD /d "256" /f
    269 rem disable action centre quick actions
    270 reg add "HKLM\SOFTWARE\Microsoft\Shell\ActionCenter\Quick Actions" /v "PinnedQuickActionSlotCount" /t REG_DWORD /d "0" /f
    271 rem disable bing search results
    272 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "BingSearchEnabled" /t REG_DWORD /d 0 /f
    273 rem disable location tracking
    274 reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" /v "SensorPermissionState" /t REG_DWORD /d "0" /f
    275 reg add "HKLM\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" /v "Status" /t REG_DWORD /d "0" /f
    276 rem disable IE first run popup
    277 reg add "HKLM\Software\Policies\Microsoft\Internet Explorer\Main" /v "DisableFirstRunCustomize" /t REG_DWORD /d "1" /f
    278 rem verbose status messages
    279 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system" /v "verbosestatus" /t REG_DWORD /d "1" /f
    280 rem disable live tiles
    281 reg add "HKCU\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" /v "NoTileApplicationNotification" /t REG_DWORD /d "1" /f
    282 rem remove startup delay
    283 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize" /v "Startupdelayinmsec" /t REG_DWORD /d "0" /f
    284 rem disable backup reminders
    285 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\BackupReminder" /v "BackupReminderToastCount" /t REG_DWORD /d "3" /f
    286 rem disable confirmation on file deletion
    287 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "ConfirmFileDelete" /t REG_DWORD /d "0" /f
    288 rem add open file location to shortcut context menu
    289 reg add "HKCR\.symlink\shellex\ContextMenuHandlers\OpenContainingFolderMenu" /ve /t REG_SZ /d "{37ea3a21-7493-4208-a011-7f9ea79ce9f5}" /f
    290 reg add "HKCR\LibraryLocation\ShellEx\ContextMenuHandlers\OpenContainingFolderMenu" /ve /t REG_SZ /d "{37ea3a21-7493-4208-a011-7f9ea79ce9f5}" /f
    291 reg add "HKCR\lnkfile\shellex\ContextMenuHandlers\OpenContainingFolderMenu" /ve /t REG_SZ /d "{37ea3a21-7493-4208-a011-7f9ea79ce9f5}" /f
    292 reg add "HKCR\RecentDocument\ShellEx\ContextMenuHandlers\OpenContainingFolderMenu" /ve /t REG_SZ /d "{37ea3a21-7493-4208-a011-7f9ea79ce9f5}" /f
    293 reg add "HKCR\Results\ShellEx\ContextMenuHandlers\OpenContainingFolderMenu" /ve /t REG_SZ /d "{37ea3a21-7493-4208-a011-7f9ea79ce9f5}" /f
    294 rem show status bar in explorer
    295 reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowStatusBar" /t REG_DWORD /d "1" /f
    296 rem disable consumer experience
    297 reg add "HKLM\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d "1" /f
    298 rem block automatic install of suggested apps
    299 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SilentInstalledAppsEnabled" /t REG_DWORD /d "0" /f
    300 rem change windows feedback frequency
    301 reg add HKCU\SOFTWARE\Microsoft\Siuf\Rules /v NumberOfSIUFInPeriod /t REG_DWORD /d 0 /f
    302 reg add HKCU\SOFTWARE\Microsoft\Siuf\Rules /v PeriodInNanoSeconds /t REG_DWORD /d 0 /f
    303 rem disable improve typing/inking recognition
    304 reg add "HKCU\SOFTWARE\Microsoft\Input\TIPC" /v "Enabled" /t REG_DWORD /d 0 /f
    305 rem allow long character paths
    306 reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v "LongPathsEnabled" /t REG_DWORD /d "1" /f
    307 rem disable snipping tool
    308 reg add "HKLM\SOFTWARE\Policies\Microsoft\TabletPC" /v "DisableSnippingTool" /t REG_DWORD /d "1" /f
    309 rem disable windows script host
    310 reg add "HKLM\Software\Microsoft\Windows Script\Settings" /v "Enabled" /t REG_DWORD /d "0" /f
    311 rem disable drive autoruns
    312 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDriveTypeAutoRun" /t REG_DWORD /d "181" /f
    313 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoAutorun" /t REG_DWORD /d "1" /f
    314 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" /v "DisableAutoplay" /t REG_DWORD /d "1" /f
    315 exit /b %errorlevel%
    316 
    317 :remove_software
    318 rem remove onedrive, remove explorer tree item
    319 tasklist /FI "IMAGENAME eq onedrive.exe" 2>NUL | find /I /N "onedrive.exe">NUL
    320 if "%ERRORLEVEL%"=="0" echo taskkill /f /im onedrive.exe
    321 if exist "%windir%\system32\onedrivesetup.exe" "%windir%\system32\onedrivesetup.exe" /uninstall
    322 if exist "%windir%\syswow64\onedrivesetup.exe" "%windir%\syswow64\onedrivesetup.exe" /uninstall
    323 reg delete "HKCR\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
    324 reg delete "HKCR\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
    325 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\OneDrive" /v "DisableFileSyncNGSC" /t REG_DWORD /d "1" /f
    326 if exist "%userprofile%\OneDrive" rd /s /q "%userprofile%\OneDrive"
    327 if exist "%localappdata%\Microsoft\OneDrive" rd /s /q "%localappdata%\Microsoft\OneDrive"
    328 if exist "%programdata%\Microsoft OneDrive" rd /s /q "%programdata%\Microsoft OneDrive"
    329 if exist "%windir%\system32\OneDriveSettingSyncProvider.dll" takeown /f "%windir%\system32\OneDriveSettingSyncProvider.dll"
    330 if exist "%windir%\system32\OneDriveSettingSyncProvider.dll" icacls "%windir%\system32\OneDriveSettingSyncProvider.dll" /grant administrators:f
    331 if exist "%windir%\system32\OneDriveSettingSyncProvider.dll" del "%windir%\system32\OneDriveSettingSyncProvider.dll"
    332 if exist "%windir%\SysWOW64\OneDriveSettingSyncProvider.dll" takeown /f "%windir%\SysWOW64\OneDriveSettingSyncProvider.dll"
    333 if exist "%windir%\SysWOW64\OneDriveSettingSyncProvider.dll" icacls "%windir%\SysWOW64\OneDriveSettingSyncProvider.dll" /grant administrators:f
    334 if exist "%windir%\SysWOW64\OneDriveSettingSyncProvider.dll" del "%windir%\SysWOW64\OneDriveSettingSyncProvider.dll"
    335 if exist "%windir%\SysWOW64\OneDriveSetup.exe" takeown /f "%windir%\SysWOW64\OneDriveSetup.exe"
    336 if exist "%windir%\SysWOW64\OneDriveSetup.exe" icacls "%windir%\SysWOW64\OneDriveSetup.exe" /grant administrators:f
    337 if exist "%windir%\SysWOW64\OneDriveSetup.exe" del "%windir%\SysWOW64\OneDriveSetup.exe"
    338 rem disable some features using dism
    339 for %%x in (Printing-XPSServices-Features WorkFolders-Client Internet-Explorer-Optional-amd64) do dism /online /disable-feature /featurename:"%%x" /quiet /norestart
    340 rem remove silverlight (https://support.microsoft.com/en-us/kb/2608523)
    341 reg delete "HKLM\Software\Microsoft\Silverlight" /f
    342 reg delete "HKCR\Installer\Products\D7314F9862C648A4DB8BE2A5B47BE100" /f
    343 reg delete "HKLM\SOFTWARE\Classes\Installer\Products\D7314F9862C648A4DB8BE2A5B47BE100" /f
    344 reg delete "HKCR\TypeLib\{283C8576-0726-4DBC-9609-3F855162009A}" /f
    345 reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\install.exe" /f
    346 reg delete "HKCR\AgControl.AgControl" /f
    347 reg delete "HKCR\AgControl.AgControl.5.1" /f
    348 reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}" /f
    349 reg delete "HKCU\SOFTWARE\AppDataLow\Software\Microsoft\Silverlight" /f
    350 if exist "%programfiles%\Microsoft Silverlight" rd /s /q "%programfiles%\Microsoft Silverlight"
    351 if exist "%programfiles(x86)%\Microsoft Silverlight" rd /s /q "%programfiles(x86)%\Microsoft Silverlight"
    352 rem remove adobe flash
    353 if exist "%windir%\System32\Macromed" takeown /f "%windir%\System32\Macromed" /r /d y
    354 if exist "%windir%\System32\Macromed\Flash\*.*" takeown /f "%windir%\System32\Macromed\Flash\*.*"
    355 if exist "%windir%\SysWOW64\FlashPlayerApp.exe" takeown /f "%windir%\SysWOW64\FlashPlayerApp.exe" /r /d y
    356 if exist "%windir%\SysWOW64\FlashPlayerCPLApp.cpl" takeown /f "%windir%\SysWOW64\FlashPlayerCPLApp.cpl" /r /d y
    357 if exist "%windir%\SysWOW64\Macromed" takeown /f "%windir%\SysWOW64\Macromed" /r /d y
    358 if exist "%windir%\SysWOW64\Macromed\Flash\*.*" takeown /f "%windir%\SysWOW64\Macromed\Flash\*.*"
    359 if exist "%windir%\System32\Macromed" icacls "%windir%\System32\Macromed" /grant administrators:F /t
    360 if exist "%windir%\SysWOW64\FlashPlayerApp.exe" icacls "%windir%\SysWOW64\FlashPlayerApp.exe" /grant administrators:F /t
    361 if exist "%windir%\SysWOW64\FlashPlayerCPLApp.cpl" icacls "%windir%\SysWOW64\FlashPlayerCPLApp.cpl" /grant administrators:F /t
    362 if exist "%windir%\SysWOW64\Macromed" icacls "%windir%\SysWOW64\Macromed" /grant administrators:F /t
    363 if exist "%appdata%\Adobe" rd /s /q "%appdata%\Adobe"
    364 if exist "%windir%\System32\Macromed" rd /s /q "%windir%\System32\Macromed"
    365 if exist "%windir%\SysWOW64\Macromed" rd /s /q "%windir%\SysWOW64\Macromed"
    366 if exist "%appdata%\Macromedia\Flash Player" rd /s /q "%appdata%\Macromedia\Flash Player"
    367 if exist "%windir%\SysWOW64\FlashPlayerApp.exe" del "%windir%\SysWOW64\FlashPlayerApp.exe"
    368 if exist "%windir%\SysWOW64\FlashPlayerCPLApp.cpl" del "%windir%\SysWOW64\FlashPlayerCPLApp.cpl"
    369 exit /b %errorlevel%
    370 
    371 :install_software
    372 rem install chocolatey
    373 @powershell Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
    374 choco feature enable -n allowGlobalConfirmation
    375 rem install essential packages
    376 choco install 7zip
    377 choco install autohotkey
    378 choco install ffmpeg
    379 choco install firefox
    380 choco install github-desktop
    381 choco install mpv
    382 choco install nomacs
    383 choco install notepad2-mod
    384 choco install paint.net
    385 choco install putty
    386 choco install rclone
    387 choco install rclonebrowser
    388 choco install scansnapmanager
    389 choco install sumatrapdf
    390 choco install syncthing
    391 choco install winfsp
    392 choco install yt-dlp
    393 rem games
    394 choco install discord
    395 choco install retroarch
    396 choco install steam-client
    397 rem add ahk-assistant if it exists
    398 if exist %userprofile%\Vault\src\ahka\ahk-assistant.ahk reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "AHK Assistant" /t REG_SZ /d "%userprofile%\Vault\src\ahka\ahk-assistant.ahk" /f
    399 rem install a few features using dism
    400 for %%x in (DirectPlay MediaPlayback NetFx3) do dism /online /enable-feature /featurename:"%%x" /quiet /norestart
    401 rem 7zip associations and use windows icon
    402 reg add "HKCU\SOFTWARE\Classes\Applications\7zFM.exe\shell\open\command" /ve /t REG_SZ /d "\"%programfiles%\7-Zip\7zFM.exe\" \"%%1\"" /f
    403 reg add "HKCR\7z_auto_file\DefaultIcon" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32\zipfldr.dll" /f
    404 rem add mumble short code
    405 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\mumble.exe" /v "Path" /t REG_SZ /d "%programfiles(x86)%\Mumble\\" /f
    406 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\mumble.exe" /ve /t REG_SZ /d "%programfiles(x86)%\Mumble\mumble.exe" /f
    407 rem agree to procmon eula
    408 reg add "HKCU\SOFTWARE\Sysinternals\Process Monitor" /v "EulaAccepted" /t REG_DWORD /d "1" /f
    409 rem add steam shortcode
    410 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\steam.exe" /v "Path" /t REG_SZ /d "%programfiles(x86)%\Steam\\" /f
    411 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\steam.exe" /ve /t REG_SZ /d "%programfiles(x86)%\Steam\Steam.exe" /f
    412 rem move syncthing binaries up a directory
    413 dir /a:d /b "%programfiles%\Syncthing" > "syncthing-ver.tmp"
    414 set /p syncthing-ver=<"syncthing-ver.tmp"
    415 move "%programfiles%\Syncthing\%syncthing-ver%\*" "%programfiles%\Syncthing\"
    416 rd /s /q "%programfiles%\Syncthing\%syncthing-ver%"
    417 del "syncthing-ver.tmp"
    418 rem move rclone binaries (similar to syncthing)
    419 dir /a:d /b "%programfiles%\Rclone" > "rclone-ver.tmp"
    420 set /p rclone-ver=<"rclone-ver.tmp"
    421 move "%programfiles%\Rclone\%rclone-ver%\*" "%programfiles%\Rclone\"
    422 rd /s /q "%programfiles%\Rclone\%rclone-ver%"
    423 del "rclone-ver.tmp"
    424 rem allow syncthing to auto update
    425 icacls "%programfiles%\Syncthing" /grant Everyone:(OI)(CI)F
    426 rem add syncthing autostart entry
    427 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "Syncthing" /t REG_SZ /d "\"%programfiles%\Syncthing\syncthing.exe\" -no-console -no-browser" /f
    428 rem add syncthing firewall rule
    429 netsh advfirewall firewall add rule name="Syncthing" dir=in action=allow program="%programfiles%\Syncthing\syncthing.exe" enable=yes
    430 rem show hidden files in winscp
    431 reg add "HKCU\Software\Martin Prikryl\WinSCP 2\Configuration\Interface" /v "DimmHiddenFiles" /t REG_DWORD /d "0" /f
    432 reg add "HKCU\Software\Martin Prikryl\WinSCP 2\Configuration\Interface" /v "ShowHiddenFiles" /t REG_DWORD /d "1" /f
    433 exit /b %errorlevel%
    434 
    435 :cleanup
    436 for %%x in (%userprofile%\Desktop\*.lnk %allusersprofile%\Desktop\*.lnk %userprofile%\Desktop\*.appref-ms %allusersprofile%\Desktop\*.appref-ms %public%\Desktop\*.lnk) do if exist "%%x" del "%%x"
    437 exit /b %errorlevel%