79396221

Date: 2025-01-29 09:25:26
Score: 0.5
Natty:
Report link

@echo off
set _toggle=0

:Start
CLS
echo 1.Switch

CHOICE /C 1 /M "Enter your choice:"

IF ERRORLEVEL 1 call:Switch

:Switch
if "%_toggle%"=="0" (goto Speakers ) else (goto Headset)

:Speakers
echo Speakers Active
nircmd.exe setdefaultsounddevice "Speakers"
set /a _toggle=%_toggle%+1
timeout /t 1 /nobreak
goto Start

:Headset
echo Headset Active
nircmd.exe setdefaultsounddevice "Headset"
set /a _toggle=%_toggle%-1
timeout /t 1 /nobreak
goto Start

Based of Forest bat and implemented with the choice bat option I found also on stack overflow, this should work like a charm, i use it to toggle the desktop icons visibility.

Reasons:
  • Whitelisted phrase (-2): this should work
  • Long answer (-0.5):
  • No code block (0.5):
  • Unregistered user (0.5):
  • User mentioned (1): @echo
  • Low reputation (1):
Posted by: Draconic Velum