命令行中的控制面板设置 [英] Control Panel Settings from Command Line
问题描述
我正在寻找一种使注册表更改"立即生效的方法. 具体来说,我想触摸的值是:
I'm looking for a way to make a Registry Change take affect right away. Specifically the value I want to touch is:
HKEY_CURRENT_USER/Control \ Panel/Desktop/WindowArrangementActive
HKEY_CURRENT_USER/Control\ Panel/Desktop/WindowArrangementActive
直接从控制面板更改此设置时,该设置立即生效,但是当我手动更改时,该设置在重新启动之前未注册.
When you change this setting directly from the Control Panel it takes effect immediately, but when I'm changing it manually, it is not registered before rebooting.
我正在尝试制作一个脚本来禁用/启用Windows 10中的窗口捕捉.
I'm trying to make a script to disable/enable window snapping in Windows 10.
我目前尝试在更改后没有运气的情况下运行以下命令:
I've currently tried running the following command after the change with no luck:
RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters,1,真
RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True
推荐答案
我最终使用SystemParametersInfo在C#中完成了工作:
I ended up getting the job done in C# using the SystemParametersInfo:
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(int uiAction, int uiParam, IntPtr pvParam, int fWinIni);
并使用以下参数进行调用:
and calling it with the following params:
SystemParametersInfo(0x0083, 0, IntPtr.Zero, 0x001A);
最后一个参数是通知系统该变量已根据Microsoft的本文档进行更改的参数:
The final param is the one informing the system that the variable has changed in accordance with this documentation by Microsoft:
https://msdn .microsoft.com/en-us/library/windows/desktop/ms725497(v = vs.85).aspx
这篇关于命令行中的控制面板设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!