🔽 English instructions are available below.
Windows에서 두 개의 오디오 장치(예: 이어폰과 스피커)를 스마트하게 전환할 수 있는 배치 스크립트입니다.
단순한 토글이 아닌, 다음과 같은 지능적인 기능을 제공합니다:
- ✅ 두 장치가 모두 연결된 경우에만 전환 실행
- 🔁 현재 기본 장치를 확인한 뒤 다른 장치로 자동 전환
- 🔊 기본 재생 장치와 기본 통신 장치를 동시에 설정
- 🔔 전환 후 트레이 알림으로 상태 표시
- ⚡ Stream Deck, AutoHotKey 등 단축키 도구와 연동 용이
💡 장치가 하나라도 연결되어 있지 않으면, 스크립트는 전환을 취소하고 경고 메시지를 표시합니다.
- GitHub에서 초록색 Code 버튼 클릭
- Download ZIP 선택
- 압축 파일을 해제한 후, 폴더에 다음 파일들이 있는지 확인:
device.batdevice.vbsInstall_Modules.ps1
Install_Modules.bat파일을 마우스 오른쪽 클릭 → 관리자 권한으로 실행- 아래 작업이 자동으로 실행됩니다:
- ✅ 실행 정책을
RemoteSigned로 설정 - 🎧
AudioDeviceCmdlets모듈 설치 (이미 설치된 경우 생략) - 🔔
BurntToast모듈 설치 (이미 설치된 경우 생략)
- ✅ 실행 정책을
- 설치가 완료되면 다음과 같은 메시지가 표시됩니다:
🎉 모든 준비 완료! 이제 배치 스크립트에서 오디오 전환과 알림을 사용할 수 있습니다. 👋 설치가 완료되었습니다! 창을 닫으려면 Enter 키를 누르세요 -
⏳ 설치 후 창이 자동으로 닫히지 않으니, Enter 키를 눌러 수동으로 닫아주세요.
Install_Modules.bat 를 통해 모듈을 설치할 수 없는 경우, 아래 명령어를 PowerShell에 직접 복사해서 붙여넣어 실행하세요:
# 실행 정책을 RemoteSigned로 변경
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force
# AudioDeviceCmdlets 설치
Install-Module -Name AudioDeviceCmdlets -Scope CurrentUser -Force
# BurntToast 설치
Install-Module -Name BurntToast -Scope CurrentUser -Force
⚠️ 모듈 설치 중 'NuGet 제공자' 관련 메시지가 나올 경우,Y를 입력하고 Enter 키를 눌러 진행하세요.
- 공식 사이트: https://www.nirsoft.net/utils/nircmd.html
- 페이지 하단에서 “NirCmd 64-bit” 다운로드
- 압축 해제 경로:
C:\Program Files\nircmd-x64 - 해당 폴더 안에
nircmd.exe파일이 있는지 확인
- 시작 메뉴에서 “시스템 환경 변수 편집” 검색 후 실행
- "환경 변수(N)..." 클릭
- 시스템 변수에서
Path선택 → "편집(I)..." 클릭 - "새로 만들기(N)" 클릭 →
C:\Program Files\nircmd-x64입력 - 모든 창을 **"확인"**으로 닫기
device.bat파일의 확장자를.txt로 변경하여 메모장에서 열기[설정]아래에earphone,speaker항목을 본인의 장치 이름으로 수정- 저장 후 확장자를
.bat로 다시 변경
- 폴더 안의
device.vbs파일을 더블 클릭 - 실행창 없이 조용히 오디오 장치가 전환됨
- Stream Deck, AutoHotKey 등에서 이
device.vbs파일을 실행하도록 연결하면 더 편리하게 사용 가능
SoundDeviceSwitcher is a batch script for smartly toggling between two audio devices on Windows (e.g., headphones and speakers).
It’s more than just a toggle—this script includes intelligent features:
- ✅ Only switches if both devices are connected
- 🔁 Automatically detects the current default device and switches to the other
- 🔊 Sets both the Default Playback Device and Default Communication Device
- 🔔 Displays a tray notification after switching
- ⚡ Easily integrates with hotkey tools like Stream Deck or AutoHotKey
💡 If either device is not connected, the script will cancel the operation and show a warning instead of switching.
- Click the green Code button on GitHub
- Select Download ZIP
- Extract the ZIP file and make sure the folder contains:
device.batdevice.vbsInstall_Modules.ps1
- Right-click
Install_Modules.batand select Run as Administrator - The following will be performed automatically:
- ✅ Set execution policy to
RemoteSigned - 🎧 Install
AudioDeviceCmdletsmodule (skipped if already installed) - 🔔 Install
BurntToastmodule (skipped if already installed)
- ✅ Set execution policy to
If you can't run the script, copy and paste the following into PowerShell manually:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force
Install-Module -Name AudioDeviceCmdlets -Scope CurrentUser -Force
Install-Module -Name BurntToast -Scope CurrentUser -Force
⚠️ If prompted to install NuGet provider, typeYand press Enter.
- Official site: https://www.nirsoft.net/utils/nircmd.html
- Scroll to the bottom and download “NirCmd 64-bit”
- Extract to:
C:\Program Files\nircmd-x64 - Ensure
nircmd.exeis present in that folder
- Open the Start menu and search for “Edit the system environment variables”
- Click “Environment Variables...”
- In the System variables section, select
Path→ click “Edit...” - Click “New” → add
C:\Program Files\nircmd-x64 - Click OK to close all windows
- Rename
device.batto.txtand open it in Notepad - Under the [Settings] section, change the
earphoneandspeakerentries to match your actual device names - Save and rename the file extension back to
.bat
- Double-click the
device.vbsfile in the folder - It will switch audio devices silently without opening any command windows
- You can link the
device.vbsfile to tools like Stream Deck or AutoHotKey for quick access