はじめに
僕は過去にYouTubeにWindows 10の終了音、起動音を復活させる動画を投稿しました。
この動画がヒットしてびっくりしました。
その後、ログオフ音、ログオン音も復活させてほしいということで、この動画を投稿しました。
しかし、これらは設定が結構面倒くさいです。
そこで、できるだけ簡単に設定できるバッチファイルを作ってみました。
内容
!Sound.bat
-
Windows の起動
を復活させます。 -
Windows ログオフ
を復活させます(ExcludeFromCPL
を0
にしても復活しなかった場合のため)。 -
アラーム 1
、着信呼の通知 1
、Windows の終了
、Windows ログオフ
、Windows ログオン
のExcludeFromCPL
を0
にします。 -
ShutdownStartupSound.vbs
を実行します(このVBScriptは次に解説します)。 -
Windows 10 Shutdown Sound.exe
を実行します。
reg
コマンドの最後に > nul
をつけている理由は、reg
コマンドが成功したときのメッセージを出力しないためです。
(メッセージを出力すると、若干遅くなるような気がしたので)
@echo off
chcp 65001 > nul
cd /d %~dp0
reg add HKCU\AppEvents\EventLabels\SystemStart /ve /d "Start Windows" /f > nul
reg add HKCU\AppEvents\EventLabels\SystemStart /v DispFileName /d @mmres.dll,-5850 /f > nul
reg add HKCU\AppEvents\Schemes\Apps\.Default\SystemStart\.Current /ve /d "" /f > nul
reg add HKCU\AppEvents\Schemes\Apps\.Default\SystemStart\.Default /ve /d "" /f > nul
reg add HKCU\AppEvents\Schemes\Apps\.Default\WindowsLogoff\.Current /ve /d "" /f > nul
reg add HKCU\AppEvents\Schemes\Apps\.Default\WindowsLogoff\.Default /ve /d "" /f > nul
reg add HKCU\AppEvents\EventLabels\Notification.Looping.Alarm /v ExcludeFromCPL /t REG_DWORD /d 0 /f > nul
reg add HKCU\AppEvents\EventLabels\Notification.Looping.Call /v ExcludeFromCPL /t REG_DWORD /d 0 /f > nul
reg add HKCU\AppEvents\EventLabels\SystemExit /v ExcludeFromCPL /t REG_DWORD /d 0 /f > nul
reg add HKCU\AppEvents\EventLabels\WindowsLogoff /v ExcludeFromCPL /t REG_DWORD /d 0 /f > nul
reg add HKCU\AppEvents\EventLabels\WindowsLogon /v ExcludeFromCPL /t REG_DWORD /d 0 /f > nul
wscript ShutdownStartupSound.vbs
start "" "Windows 10 Shutdown Sound.exe"
ShutdownStartupSound.vbs
バッチファイルではショートカットが作成できません。
そのため、このVBScriptがあります。
これは、Windows 10 Shutdown Sound.exe
、起動音
をスタートアップに登録します。
Option Explicit
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim cd
cd = objFSO.GetParentFolderName(WScript.ScriptFullName)
Dim shell
Set shell = WScript.CreateObject("WScript.Shell")
dim startupPath
startupPath = shell.ExpandEnvironmentStrings("%APPDATA%") & "\Microsoft\Windows\Start Menu\Programs\Startup"
Dim shortCut
Set shortCut = shell.CreateShortcut(startupPath & "\Windows 10 Shutdown Sound.lnk")
With shortCut
.TargetPath = objFSO.GetAbsolutePathName("Windows 10 Shutdown Sound.exe")
.WorkingDirectory = cd
.save
End With
Set shortCut = Nothing
Set shortCut = shell.CreateShortcut(startupPath & "\起動音.lnk")
With shortCut
.TargetPath = objFSO.GetAbsolutePathName("WindowsSound.exe")
.Arguments = "SystemStart"
.WorkingDirectory = cd
.save
End With
Set shortCut = Nothing
Set objFSO = Nothing
Set shell = Nothing
注意
タスクの作成はコマンドプロンプトで簡単に作ることができません。
なので、ログオフ音、ログオン音のタスクを作るには、
Windows 10でログオフ音、ログオン音を復活させてみたの通りに作るしかありません。
その他のファイル
このZIPには他にも次のものが入っています。
DefaultAppEvents.reg
、DefaultEventLabels.reg
、DefaultSchemes.reg
は、それぞれ
Windows 10のデフォルトの
HKEY_CURRENT_USER\AppEvents
HKEY_CURRENT_USER\AppEvents\EventLabels
HKEY_CURRENT_USER\AppEvents\Schemes
です。
DefaultWin11AppEvents.reg
、DefaultWin11EventLabels.reg
、DefaultWin11Schemes.reg
は、それぞれ
Windows 11のデフォルトの
HKEY_CURRENT_USER\AppEvents
HKEY_CURRENT_USER\AppEvents\EventLabels
HKEY_CURRENT_USER\AppEvents\Schemes
です。
DeleteAppEvents.reg
、DeleteEventLabels.reg
、DeleteSchemes.reg
は、それぞれ
HKEY_CURRENT_USER\AppEvents
HKEY_CURRENT_USER\AppEvents\EventLabels
HKEY_CURRENT_USER\AppEvents\Schemes
を削除します。
SoundDefault.reg
は、ExcludeFromCPL
の値をデフォルトにします。
SoundFullOpen.reg
は、ExcludeFromCPL
の値をすべて0
にします。
SoundNormal.reg
は、アラーム 1
、着信呼の通知 1
、Windows の終了
、Windows ログオフ
、Windows ログオン
のみExcludeFromCPL
の値を0
にします(!Sound.bat
の中でやっていることと同じです)。
SystemStart.reg
、WindowsLogoff.reg
は、それぞれWindows の起動
、Windows ログオフ
を復活させます(!Sound.bat
の中でやっていることと同じです)。
サウンド設定を初期化する方法
-
DeleteAppEvents.reg
を登録します。 - Windows 10の場合、
DefaultAppEvents.reg
を登録します。
Windows 11の場合、DefaultWin11AppEvents.reg
を登録します。
注意: これを使って初期化すると、Windows、エクスプローラー、Windows 音声認識以外の音(Visual Studioの音など)は消えてしまいます。
ですので、あらかじめレジストリエディターで、HKEY_CURRENT_USER\AppEventsのバックアップを取ることをお勧めします。
BatterySound.bat
BatterySound.bat
は、Battery Modeのスケジューラーを自動的に設定します。
僕が作ったこの動画のスケジューラーの設定を簡単にすることができます。
Battery Modeは、こちらからダウンロードできます。
Battery Mode - Windows Battery Indicator Replacement
@echo off
chcp 65001 > nul
cd /d %~dp0
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0" /v Braked /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0" /v Enabled /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0" /v ID /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0" /v Name /d バッテリ充電完了アラーム /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0" /v Operation /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0\Action 0" /v ID /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0\Action 0" /v Setting /d バッテリーの充電が完了しました。充電器を取り外してください。 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0\Action 0" /v Type /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0\Action 1" /v ID /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0\Action 1" /v Setting /d "\"%CD%\WindowsSound.exe\" Notification.Proximity<*@:>False" /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0\Action 1" /v Type /t REG_DWORD /d 3 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0\Trigger 0" /v ID /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0\Trigger 0" /v Setting /d RiseAbove:79 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 0\Trigger 0" /v Type /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 1" /v Braked /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 1" /v Enabled /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 1" /v ID /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 1" /v Name /d バッテリ充電開始音 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 1" /v Operation /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 1\Action 0" /v ID /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 1\Action 0" /v Setting /d "\"%CD%\WindowsSound.exe\" ProximityConnection<*@:>False" /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 1\Action 0" /v Type /t REG_DWORD /d 3 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 1\Trigger 0" /v ID /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 1\Trigger 0" /v Setting /d Inject /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 1\Trigger 0" /v Type /t REG_DWORD /d 2 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2" /v Braked /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2" /v Enabled /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2" /v ID /t REG_DWORD /d 2 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2" /v Name /d バッテリ低下アラーム /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2" /v Operation /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2\Action 0" /v ID /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2\Action 0" /v Setting /d バッテリーが低下しました。充電する準備をしてください。 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2\Action 0" /v Type /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2\Action 1" /v ID /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2\Action 1" /v Setting /d "\"%CD%\WindowsSound.exe\" LowBatteryAlarm<*@:>False" /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2\Action 1" /v Type /t REG_DWORD /d 3 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2\Trigger 0" /v ID /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2\Trigger 0" /v Setting /d DropBelow:31 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 2\Trigger 0" /v Type /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3" /v Braked /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3" /v Enabled /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3" /v ID /t REG_DWORD /d 3 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3" /v Name /d バッテリ切れアラーム /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3" /v Operation /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3\Action 0" /v ID /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3\Action 0" /v Setting /d バッテリーが切れそうになりました。充電してください。 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3\Action 0" /v Type /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3\Action 1" /v ID /t REG_DWORD /d 1 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3\Action 1" /v Setting /d "\"%CD%\WindowsSound.exe\" CriticalBatteryAlarm<*@:>False" /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3\Action 1" /v Type /t REG_DWORD /d 3 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3\Trigger 0" /v ID /t REG_DWORD /d 0 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3\Trigger 0" /v Setting /d DropBelow:21 /f > nul
reg add "HKCU\Software\Battery Mode\Scheduler\Rule 3\Trigger 0" /v Type /t REG_DWORD /d 1 /f > nul
ダウンロード
ダウンロードはここからできます。
インストールしていない場合は、こちらもダウンロードしてください。