Temporarily Disabling Nvidia GPU with devcon.exe and AutoHotkey: Secondary Display Issue
In some cases, you might need to temporarily disable the Nvidia GPU, especially when you encounter issues with the secondary display or GPU output. This article will guide you through the process of disabling the Nvidia GPU using devcon.exe and AutoHotkey.
What is devcon.exe?
Devcon.exe is a command-line utility that allows you to manage, disable, and enable devices on your computer. It is a part of the Windows Driver Kit (WDK) and can be used to troubleshoot and resolve device-related issues.
What is AutoHotkey?
AutoHotkey is a powerful scripting language for automating tasks in Windows. It allows you to create custom scripts that can interact with the operating system, automate repetitive tasks, and create hotkeys for various actions.
Disabling the Nvidia GPU with devcon.exe
To disable the Nvidia GPU using devcon.exe, follow these steps:
- Download and install the Windows Driver Kit (WDK) from the official Microsoft website.
- Open the Command Prompt as an administrator.
- Type the following command to list all the devices:
devcon.exe findallThis will display a list of all the devices on your computer.
- Identify the Nvidia GPU from the list and note down its hardware ID.
- Type the following command to disable the Nvidia GPU:
devcon.exe disable "<hardware\_id>"Replace <hardware\_id> with the hardware ID of the Nvidia GPU that you noted down in step 5.
Creating an AutoHotkey script to disable the Nvidia GPU
To create an AutoHotkey script that can disable the Nvidia GPU, follow these steps:
- Download and install AutoHotkey from the official website.
- Create a new text file and rename it with the extension .ahk.
- Add the following code to the file:
#Requires AutoHotkey v1.1
RegRead, OutputVar, HKU\ControlPanel\Desktop, userpreferreddisplaymode
if OutputVar = 1
{
Run, cmd.exe /k devcon.exe disable "<hardware\_id>"
Sleep, 5000
Run, reg.exe add HKU\ControlPanel\Desktop /v userpreferreddisplaymode /t REG\_SZ /d 0 /f
}Replace <hardware\_id> with the hardware ID of the Nvidia GPU that you noted down in step 5.
- Save the file and double-click it to run the script.
This script will disable the Nvidia GPU and change the userpreferreddisplaymode registry key to 0, which will force the secondary display to use the integrated GPU.
- Devcon.exe is a command-line utility that allows you to manage, disable, and enable devices on your computer.
- AutoHotkey is a powerful scripting language for automating tasks in Windows.
- To disable the Nvidia GPU using devcon.exe, you need to list all the devices, identify the Nvidia GPU, and disable it using its hardware ID.
- To create an AutoHotkey script that can disable the Nvidia GPU, you need to download and install AutoHotkey, create a new text file with the extension .ahk, and add the code to disable the Nvidia GPU and change the userpreferreddisplaymode registry key to 0.
References
- Microsoft. (2021). Devcon.exe. Retrieved from https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon
- AutoHotkey. (2021). AutoHotkey. Retrieved from https://www.autohotkey.com/