(view source code of dxsound.bat as plain text)
@ECHO OFF
:: Check Windows version
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
:: Check if XML Starlet is available
XML.EXE --version >NUL 2>&1 || GOTO Syntax
:: Check command line arguments
ECHO.%* | FIND "?" >NUL
IF NOT ERRORLEVEL 1 GOTO Syntax
IF NOT "%~1"=="" IF /I NOT "%~1"=="/F" GOTO Syntax
:: If /F switch is used, an existing DxDiag generated XML file will be deleted
IF /I "%~1"=="/F" IF EXIST %~sdpn0.xml DEL %~sdpn0.xml
:: If there is no DxDiag generated file available, create a new one (may take a minute)
IF NOT EXIST %~sdpn0.xml DXDIAG.EXE /whql:off /x %~sdpn0.xml
:: Loop through our selection of properties . . .
FOR %%A IN (Description HwAccelLevel DefaultSoundPlayback DefaultVoicePlayback) DO (
SET Count=0
REM Use the -m XPATH expression to select the proper XML nodes; then
REM use the -v XPATH expression to return the desired property value
FOR /F "tokens=*" %%B IN ('XML.EXE sel -B -I -T -t -m "/DxDiag/DirectSound/SoundDevices/SoundDevice" -v "%%A" -n %~sdpn0.xml') DO (
CALL :GetPropertyValue %%A "%%~B"
)
)
:: Display the results
ECHO.
ECHO %Count% instances:
FOR /L %%A IN (0,1,%Count%) DO (
ECHO.
SET DxSound%%A 2>NUL
)
SET Count=
GOTO:EOF
:GetPropertyValue
:: SET DXSOUND[sound_index].[property_name]=[property_value]
SET DxSound%Count%.%1=%~2
SET /A Count += 1
GOTO:EOF
:Syntax
ECHO.
ECHO DxSound.bat, Version 1.00 for Windows XP
ECHO List a selection of properties for each sound device
ECHO.
ECHO Usage: DXSOUND [ /F ]
ECHO.
ECHO Where: /F forces DxDiag.exe to create a new XML file
ECHO.
ECHO Notes: Results are displayed and saved in environment variables DxSoundX.PPP
ECHO (X is the index number of the sound device, PPP is the property name).
ECHO DxDiag.exe (native) is required to save DirectX data to an XML file.
ECHO The creation of the XML file may take a long time, so the batch file
ECHO will reuse it if available, unless the /F command line switch is used.
ECHO XML Starlet is required to read the XML file.
ECHO Download XML starlet from http://sourceforge.net/projects/xmlstar/
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
IF "%OS%"=="Windows_NT" COLOR 00
page last modified: 2024-04-16; loaded in 0.0078 seconds