I recently was involved in getting a friend with nice big flat panel TV who wanted to display his computer on TV in a simple way The way you normally do it is manually enable both the video for HDMI and the sound for HDMI as well by digging into the control panel. Since he is a bit of a novice with computers, I decided to script the process for him.

The following is the batch file I gave him:

@echo off
cd nircmd
Echo HDMI mode ON
DisplaySwitch.exe /external
nircmd.exe setdefaultsounddevice “Name of HDMI Sound” 0
Echo HDMI mode OFF
nircmd.exe setdefaultsounddevice “Name of Internal Sound” 0
DisplaySwitch.exe /internal

This script will enable the TV display and change the Default Sound Device to HDMI Then Pause. If you hit a key again, it will change the settings back.

To use this script you will need:

1. The names of the sound devices on this system. You get these in Windows 7 by going to Start > Control Panel> Manage Audio Devices. Your HDMI TV will need to plugged into the computer.

Sound Device in Windows 7

My devices were “SAMSUNG-1” for HDMI sound and “Speakers / Headphones” for internal sound.

2. The tool Nircmd from the site www.nirsoft.net. Make a folder on root of the c: drive called c:\u\nircmd and extract the nircmd files there.

3. Open notepad and copy the the batch file commands above into it and modify the sound devices names as stated in item 1. Save the file C:\U\ChangeDisplay.cmd

The command DisplaySwitch.exe is built into Windows 7.

Now you can just run the command C:\U\ChangeDisplay.cmd to enable and disable HDMI Video and Sound.

Leave a Reply