该Settings > Devices > AutoPlay > "Removable drive"
选项的用户特定设置,注册表位置在哪里(大概在HKEY_CURRENT_USER下)?
用户可以选择:
如果该设置位于注册表之外的其他地方,那在哪里?基本上,我想以编程方式配置此选项。我在这里提出问题的原因是,我已经知道如何使用注册表和文件系统。我只需要知道在哪里,因此更多是关于超级用户的问题。是的,我的第一个想法是在Stack Overflow上发帖,但是我不问编程问题,尽管我会使用C#进行编程,因为我知道那部分。我被困在实际位置上。
管理员(或用户)可以启用/禁用自动播放策略的另一个区域是gpedit.msc
。基本上,运行(Windows键+ R)gpedit.msc
启动Local Group Policy Editor
。从那里选择
本地计算机策略>用户配置>管理模板> Windows组件>自动播放策略
This avenue seems more complicated, but a possibility. Still, I would need to know where this setting is physically (I presume the registry as well).
I want to be able to programmatically, hence the "where", to temporarily disable launching File Explorer or take any other action on drives (USB, SATA, whatever) and then set the setting back to the original value once my task completes.
Just to be complete on all the areas, where a user can set AutoPlay settings, the traditional Control Panel
is the third way. I am doing research on my problem and ran into this way. A user would go to the Windows Control Panel
and select the View by Small Icons from the category dropdown and then select AutoPlay. I already found out via testing that setting the value in Settings automatically updates the Control Panel area. That means that both read from the same location dynamically, which I would presume is the registry.
UPDATE:
I saw this article, which states the registry entry NoDriveTypeAutoRun
in the following key, but that has no effect on my Windows 10 Professional X64
system with all the latest updates. I changed the value in Settings and refreshed the registry to see no change.
HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explore
UPDATE 2
I found this article on how to disable AutoPlay programmatically. The article, although a programming topic, does answer my question, namely that the registry setting that I mentioned above, takes effect only after restarting Windows Explorer (logging off and then back on).
This article does indeed require a restart of Explorer, HOWEVER there is definitely an answer, as selecting a new option in Control Panel AutoPlay or the Settings/Devices/AutoPlay area is IMMEDIATE with no restart of Explorer. As such, there is a solution.
Maybe the solution is to write in 2 places: HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER. Whatever Settings does behind the scenes is what I wish to do, just I do not know what the Microsoft applet does.
ANSWER:
Based on the method exposed by the accepted answer, I got these two registry values.
Open Folder
39:21.9 SystemSettings.exe 13908 RegSetValue HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\UserChosenExecuteHandlers\StorageOnArrival\(Default) SUCCESS Type: REG_SZ, Length: 26, Data: MSOpenFolder
MSOpenFolder
39:21.9 SystemSettings.exe 13908 RegSetValue HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\StorageOnArrival\(Default) SUCCESS Type: REG_SZ, Length: 26, Data: MSOpenFolder
MSOpenFolder
Take No Action
41:43.7 SystemSettings.exe 13908 RegSetValue HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\UserChosenExecuteHandlers\StorageOnArrival\(Default) SUCCESS Type: REG_SZ, Length: 30, Data: MSTakeNoAction
MSTakeNoAction
41:43.7 SystemSettings.exe 13908 RegSetValue HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\StorageOnArrival\(Default) SUCCESS Type: REG_SZ, Length: 30, Data: MSTakeNoAction
MSTakeNoAction
Where is the registry location for the Settings > Devices > AutoPlay > "Removable drive" option?
tl;dr: The registry location is:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers
Windows Registry Editor Version 5.00
;Disable AutoPlay
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers]
"DisableAutoplay"=dword:1
;Take No Action
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\CameraAlternate\ShowPicturesOnArrival]
@="MSTakeNoAction"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\StorageOnArrival]
@="MSTakeNoAction"
;Open folder to view files (File Explorer)
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\CameraAlternate\ShowPicturesOnArrival]
@="MSOpenFolder"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\StorageOnArrival]
@="MSOpenFolder"
;Ask me every time
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\CameraAlternate\ShowPicturesOnArrival]
@="MSPromptEachTime"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\StorageOnArrival]
@="MSPromptEachTime"
;Configure storage settings (Settings)
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\CameraAlternate\ShowPicturesOnArrival]
@="MSStorageSense"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\StorageOnArrival]
@="MSStorageSense"
这些注册表设置可以在C / C ++RegSetValue()
或C#中轻松转换RegistryKey.SetValue Method
。Dropbox选项由该程序本身处理。如上所述,用ProcMon查找那些注册表。在本文中查看更多详细信息。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句