@echo off
echo 百汇阳光研发 企业服务QQ：800094555
echo 2013-7-17
if not "%~1"=="p" start /min cmd.exe /c %0 p&exit
::检测UTS声卡是否插上
set utsID=
set weizhi=
set uts=HKLM\SYSTEM\CurrentControlSet\services\utracksatellite\Enum /v 0
for /f "tokens=1* delims=Z" %%i in ('reg query %uts%') do set "weizhi=%%j"
set "utsID=%weizhi:~1%"
for /f "tokens=* delims= " %%i in ("%utsID%") do set "utsID=%%i"
if not %utsID:~0,3%==USB msg %username% "请插上UTS声卡后重新运行"&&exit
msg %username% /time:3  "UTS 通道切换中..."
rem echo "%utsID%"


reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_00\00_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_00\00_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_00\02_00" /v Flags /t REG_DWORD /d 1 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_00\02_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_00\02_02" /v Flags /t REG_DWORD /d 1 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_00\02_03" /v Flags /t REG_DWORD /d 0 /f>nul



reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_01\00_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_01\00_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_01\02_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_01\02_01" /v Flags /t REG_DWORD /d 1 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_01\02_02" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_01\02_03" /v Flags /t REG_DWORD /d 1 /f>nul



reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_02\00_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_02\00_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_02\02_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_02\02_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_02\02_02" /v Flags /t REG_DWORD /d 1 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_02\02_03" /v Flags /t REG_DWORD /d 0 /f>nul



reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_03\00_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_03\00_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_03\02_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_03\02_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_03\02_02" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\00_03\02_03" /v Flags /t REG_DWORD /d 1 /f>nul



reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\05_00\00_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\05_00\00_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\05_00\02_00" /v Flags /t REG_DWORD /d 1 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\05_00\02_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\05_00\02_02" /v Flags /t REG_DWORD /d 1 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\05_00\02_03" /v Flags /t REG_DWORD /d 0 /f>nul



reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\05_01\00_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\05_01\00_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\05_01\02_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\05_01\02_01" /v Flags /t REG_DWORD /d 1 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\05_01\02_02" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%utsID%\Device Parameters\Mixer\05_01\02_03" /v Flags /t REG_DWORD /d 1 /f>nul


::检测UTS驱动安装位置
set utsdrvPath=
set utsweizhi=
if exist %windir%\SysWOW64 (
	set utsdrive=HKLM\SOFTWARE\Wow6432Node\IconGlobal\utracksatellite\Drivers\Setup /v InstallPath
) else (
	set utsdrive=HKLM\SOFTWARE\IconGlobal\utracksatellite\Drivers\Setup /v InstallPath 
)
for /f "tokens=1* delims=Z" %%i in ('reg query %utsdrive%') do set "utsweizhi=%%j"
set "utsdrvPath=%utsweizhi:~1%"
for /f "tokens=* delims= " %%i in ("%utsdrvPath%") do set "utsdrvPath=%%i"
rem echo "%utsdrvPath%"
call "%utsDrvPath%\utracksatellitesvc.exe" -stop
call "%utsDrvPath%\utracksatellitesvc.exe" -start
msg %username% /time:2 "通道切换完毕"
