If you've ever wanted to temporarily disable the touch screen on your Windows 8 laptop (which is useful when drawing on the screen with a stylus), you may have experienced the amount of effort it takes to do so. With some models, you can edit a setting in the control panel. For many models, however, you must manually disable the touch screen device in the device manager.
This tutorial will help you create a taskbar button to toggle enabling/disabling the touch screen.
- Technical skill level required: intermediate
- Time required: 30-45 minutes
- Installing Devcon
- Get the touchscreen Hardware ID
- Creating and testing a toggle_touch batch file
- Creating the batch file shortcut
- Testing it out
In order to enable/disable the touch screen from outside the control panel or device manager, we must use some system software called Devcon, which stands for Windows Device Console.
With Windows 7, Microsoft provided official standalone downloads of Devcon. With Windows 8, however, Devcon is only distributed as a utility program bundled with Visual Studio Express and the Windows 8 WDK. That's a few GBs of downloading just to get a tiny executable. I have repackaged the Devcon executables for Windows 8/8.1, 32/64 bit into a .zip file to save you some time and hard drive space.
Download devcon.zip (MD5: 4f80d0355f7083424841976fc42970fa)
If you would rather install from the official sources, install the WDK and Visual Studio Express
Unzip the file and navigate the directories based on your system specifications
(Windows 8/8.1, OS version). In order to access devcon.exe from the command
line, we need to get the executable on the system PATH. The easiest way to do so
is to move the appropriate devcon.exe to the
C:\Windows\System32 directory. If
you know how to manually alter the PATH, you are welcome to do that instead.
If you installed devcon.exe from the official Microsoft sources, it should be located at one of the following locations:
C:\Program Files (x86)\Windows Kits\8\Tools\x86\devcon.exe(Windows 8, 32 bit)
C:\Program Files (x86)\Windows Kits\8\Tools\x64\devcon.exe(Windows 8, 64 bit)
C:\Program Files (x86)\Windows Kits\8.1\Tools\x86\devcon.exe(Windows 8.1, 32 bit)
C:\Program Files (x86)\Windows Kits\8.1\Tools\x64\devcon.exe(Windows 8.1, 64 bit)
Verifying Devcon installation
To verify devcon was installed correctly, we need to open up an Admin command prompt. To do so, go to the Desktop, then press Windows+x. Select "Command Prompt(Admin)"
Now execute the command
devcon. Your result should look like the session
Now that we have successfully installed devcon, we need to verify that we can successfully use devcon to enable/disable our touch screen.
We need to open the Device Manager. To open the Device Manager, go to the Desktop and press Windows.+x (just like getting to the Admin command prompt). Click the "Device Manager" option in the window that pops up.
Click the small triangle to open the menu beside "Human Interface Devices". Find the "HID-compliant touch screen" device. Right click it, then select "Properties".
Once you have the Properties window open, click the Details tab. You will see a
dropdown box under the word "Property". Select "Hardware Ids". Select the value
of the form
HID\VID_####&PID_####&COL##. Right click the value and select
"Copy" to copy this hardware id to your clipboard.
Next, download this toggle_touch.bat batch file.
If you're having problems downloading the batch file directly, here's the file contents.
set "touchscreenid=YOUR_TOUCHSCREEN_HARDWARE_ID_HERE" devcon status "%touchscreenid%" | findstr "running" if %errorlevel% == 0 ( devcon disable "%touchscreenid%" ) else ( devcon enable "%touchscreenid%" )
Replace YOUR_TOUCHSCREEN_HARDWARE_ID_HERE with the Hardware ID Value you have copied to your clipboard. Save the batch file and exit your text editor.
Now we finally get to see our touch screen become enabled/disabled! Locate your toggle_touch batch file. Right click it and select "Run as administrator".
You will see a command prompt momentarily appear. If your touch screen was enabled, it should be disabled now. If it is not disabled, please ensure your hardware ID was pasted into the batch file correctly.
Run the script as administrator again, and your touch screen should be toggled from its previous state.
Now we're almost done!
Since we cannot directly run batch files with Administrator privileges without right clicking, nor can we easily place batch files on the taskbar, we have to go through some extra steps to make this script work correctly.
Although batch files cannot be run with Administrator privileges, shortcuts can be! Why that's the case...I have no idea, but it is what it is. So the trick here is to simply make a shortcut which executes the batch file.
Locate your toggle_touch.bat file. Right click it, and then Click 'create shortcut'. Right click the newly created shortcut, and select Properties. We have a few values to adjust here.
Select the target option. Currently, the target is just the path to the original batch file. Adjust the target to have a double quote before and after the path. For example,
cmd.exe /C before the path. Your target value should now resemble
cmd.exe /C "C:\Users\JoeQuery\Documents\toggle_touch.bat"
To prevent the command prompt from temporarily popping up, we can select 'Minimized' from the Run dropdown menu
Now click on the Advanced button, and check "Run as administrator"
Now all that's left is to give our shortcut a cool icon. Any .ico file will do. You're welcome to use the blue finger icon shown in the preview image at the beginning of this post.
Simply click the "Change Icon" button and browse the folder explorer to the ico file.
You should now be able to simply double click on the shortcut, and the touch screen should toggle being enabled/disabled.
After you have verified it works, right click on the taskbar to ensure it is not locked. Finally, drag the shortcut onto the task bar.
You now have a toggle touch screen button!