Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :: !!!Need to run as admin to enable taskkill command!!! (Can set to run as admin in properties if you create a shortcut of the batch file).
- :: LINKS --
- :: REQUIRED -- nircmd link - http://www.nirsoft.net/utils/nircmd.html
- :: REQUIRED -- Create a folder anywhere you like and extract nircmd (eg. C:\Program Files\audio device\).
- :: REQUIRED -- "nircmd" adds audio device control options, such as volume level and device switching.
- :: Highly recommend "notepad++" text editor if you don't already have it. -- https://notepad-plus-plus.org/downloads/
- :: Optional, converts batch files into a program. -- bat to exe converter - http://www.softpedia.com/get/System/File-Management/Batch-To-Exe-Converter.shtml
- :: Optional, allows you to create custom icons for your program. -- icon converter - http://icoconvert.com/
- :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- @ECHO off
- cls
- :: Size and color of window.
- title AUDIO
- mode con: cols=37 lines=12
- color 06
- :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- :: Prevents multiple instances, but not required. Remove both semicolons from desired section, or add to both sections to disable feature.
- :: Lines starting with 2 semicolons "::" are ignored.
- ::
- :: If converted to exe. -- Replace "Audio.exe" with whatever you name the exe you create. Then remove semicolons from the next 2 lines, and add them to the section below.
- :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- ::for /f %%A in ('tasklist ^| findstr /i "Audio.exe"') do set /a cnt+=1
- ::IF "%cnt%"=="1" goto start
- :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- :: If running as a batch file -- remove semicolons from the next 2 lines, and add them to the section above.
- :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- ::for /f %%A in ('tasklist ^| findstr /i "cmd.exe"') do set /a cnt+=1
- ::IF "%cnt%"=="2" goto start
- :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- ::goto end
- :start
- ECHO -----------------------------------
- ECHO.
- ECHO. AUDIO DEVICES
- ECHO.
- :: Anything after "ECHO" is displayed in the command prompt.
- :: Add, remove, or change options to reflect your own.
- ECHO. 1. TV
- ECHO. 2. HEADSET
- ECHO. 3. SPEAKERS
- ECHO.
- choice /C 123 /M "Select : "
- goto menu%errorlevel%
- :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- :: ("D:\Prog\audio\VAC\nircmdc") -- change "nircmdc" directory to wherever you have it installed (eg:"C:\Program Files\audio device")..
- :: (setdefaultsounddevice "TV" 1) -- is the audio device nircmdc selects as the default. must be spelled exactly the same as it is in windows (Control Panel\Hardware and Sound\Sound)..
- :: (setsysvolume 13107) -- is a nircmdc option that sets the volume for a device. 13107 is %20 volume, 32768 is %50, 65535 is %100 volume..
- :: (ECHO Default audio device set to TV.) -- anything afer "ECHO" is just text that the command prompt displays, can be changed to whatever you want..
- :: commands seperated with "&"(run previous command then this), "&&" (only run this if previous command is successful), "||" (only run this if previous command fails)..
- :: if there are any spaces in a command they must be enclosed in quotes (eg: "C:\Program Files\nircmdc" or "Line 1").
- :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- :menu1
- "D:\Prog\audio\VAC\nircmdc" setdefaultsounddevice "TV" 1 & "D:\Prog\audio\VAC\nircmdc" setsysvolume 13107 "TV" &
- ::"D:\Prog\audio\VAC\nircmdc" setdefaultsounddevice "Microphone" 1 &
- cls
- ECHO.
- ECHO Default audio device set to TV.
- ECHO.
- goto start
- :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- :menu2
- "D:\Prog\audio\VAC\nircmdc" setdefaultsounddevice "Headset" 1 & "D:\Prog\audio\VAC\nircmdc" setsysvolume 65535 "Headset" &
- ::"D:\Prog\audio\VAC\nircmdc" setdefaultsounddevice "Microphone" 1 &
- cls
- ECHO.
- ECHO Default audio device set to HEADSET.
- ECHO.
- goto start
- :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- :menu3
- "D:\Prog\audio\VAC\nircmdc" setdefaultsounddevice "Speakers" 1 & "D:\Prog\audio\VAC\nircmdc" setsysvolume 13107 "Speakers" &
- ::"D:\Prog\audio\VAC\nircmdc" setdefaultsounddevice "Microphone" 1 &
- cls
- ECHO.
- ECHO Default audio device set to SPEAKERS.
- ECHO.
- goto start
- :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- ::- :menu4
- ::- :menu5
- :menu0
- goto start
- :end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement