chcp 932

@ECHO ON

@echo Uninstall

cd /d %~dp0

@echo Get Audio Device
SetDefaultAudioDevice -w

@echo YamahaAEDriver Package Component
devcon remove "./YamahaAEDriver Package Component/YamahaAEDriver_component.inf" SWC\YamahaAEDriver_ComponentID

@echo YamahaAEDriver Package Extension
devcon remove "./YamahaAEDriver Package Extension/YamahaAEDriver_extension.inf" ROOT\YamahaAEDriver

@echo YamahaAEDriver Package Base
devcon remove "./YamahaAEDriver Package Base/YamahaAEDriver.inf" ROOT\YamahaAEDriver

@echo YamahaAudioRelay Package
devcon remove "./YamahaAudioRelay Package/YARelay.inf" Root\YARelay

@echo pnputil-d oem*.inf
RemoveOem -r
if %ERRORLEVEL% equ 0 (
	echo 削除に成功しました。
) else (
	echo 削除に失敗しました。
)

@echo Install
@echo YamahaAEDriver Package Base
devcon install "./YamahaAEDriver Package Base/YamahaAEDriver.inf" ROOT\YamahaAEDriver

@echo YamahaAEDriver Package Extension
devcon update "./YamahaAEDriver Package Extension/YamahaAEDriver_extension.inf" ROOT\YamahaAEDriver

@echo YamahaAEDriver Package Component
devcon update "./YamahaAEDriver Package Component/YamahaAEDriver_component.inf" SWC\YamahaAEDriver_ComponentID

@echo YamahaAudioRelay Package
devcon install "./YamahaAudioRelay Package/YARelay.inf" Root\YARelay

@echo Set Audio Device
timeout /t 5 > nul
SetDefaultAudioDevice -r

@echo Done
