1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Windows】Windows 10、11の音をもっと豊かにするバッチファイル

Last updated at Posted at 2022-02-24

はじめに

僕は過去にYouTubeにWindows 10の終了音、起動音を復活させる動画を投稿しました。

この動画がヒットしてびっくりしました。

その後、ログオフ音、ログオン音も復活させてほしいということで、この動画を投稿しました。

しかし、これらは設定が結構面倒くさいです。

そこで、できるだけ簡単に設定できるバッチファイルを作ってみました。

内容

!Sound.bat

  1. Windows の起動を復活させます。
  2. Windows ログオフを復活させます(ExcludeFromCPL0にしても復活しなかった場合のため)。
  3. アラーム 1着信呼の通知 1Windows の終了Windows ログオフWindows ログオンExcludeFromCPL0にします。
  4. ShutdownStartupSound.vbsを実行します(このVBScriptは次に解説します)。
  5. Windows 10 Shutdown Sound.exeを実行します。

regコマンドの最後に > nulをつけている理由は、regコマンドが成功したときのメッセージを出力しないためです。
(メッセージを出力すると、若干遅くなるような気がしたので)

!Sound.bat
@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起動音をスタートアップに登録します。

ShutdownStartupSound.vbs
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.regDefaultEventLabels.regDefaultSchemes.regは、それぞれ
Windows 10のデフォルトの
HKEY_CURRENT_USER\AppEvents
HKEY_CURRENT_USER\AppEvents\EventLabels
HKEY_CURRENT_USER\AppEvents\Schemes
です。

DefaultWin11AppEvents.regDefaultWin11EventLabels.regDefaultWin11Schemes.regは、それぞれ
Windows 11のデフォルトの
HKEY_CURRENT_USER\AppEvents
HKEY_CURRENT_USER\AppEvents\EventLabels
HKEY_CURRENT_USER\AppEvents\Schemes
です。

DeleteAppEvents.regDeleteEventLabels.regDeleteSchemes.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着信呼の通知 1Windows の終了Windows ログオフWindows ログオンのみExcludeFromCPLの値を0にします(!Sound.batの中でやっていることと同じです)。

SystemStart.regWindowsLogoff.regは、それぞれWindows の起動Windows ログオフを復活させます(!Sound.batの中でやっていることと同じです)。

サウンド設定を初期化する方法

  1. DeleteAppEvents.regを登録します。
  2. 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

BatterySound.bat
@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

ダウンロード

ダウンロードはここからできます。

インストールしていない場合は、こちらもダウンロードしてください。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?