Small utility that sets Windows settings via the back-end used by the Windows 10 setting app.
Reads a JSON array of payloads from stdin:
WindowsSettings < payload.json
List all possible settings for the current system:
WindowsSettings -list
The payload sent to the application's standard input looks like this:
[
{
"settingID": "SystemSettings_Accessibility_Magnifier_IsEnabled",
"method": "SetValue",
"parameters": [ true ]
}
]
settingID
: The setting ID. SeeWindowsSettings -list
method
: The method of to invoke.parameters
: Parameters to pass (optional).
There can be several items, allowing more than one setting to be applied.
See examples
Method | |
---|---|
GetValue [name] |
Gets a value, returning the result. name is used if there are different values. |
SetValue [name,] value |
Sets the value. |
Invoke |
Invokes an Action setting. |
GetPossibleValues |
Returns a list of settings allowed for List settings |
IsEnabled |
Returns a boolean indicating if the setting is enabled. |
IsApplicable |
Returns a boolean indicating if the setting is applicable. |
These are the exposed methods of the SettingItem class.
The type of a setting can be retrieved with WindowsSettings -list
.
The GetValue
method returns the value, and SetValue
sets it.
Boolean
andString
settings are straightforward.List
settings accept one of several possible values (or the index, depending on the setting), returned byGetPossibleValues
.Range
appears to be numeric, determining the min and max value is currently unknown.LabeledString
is read-only.
Settings of this type perform an action when the Invoke
method is used.
Unsupported - needs further investigation.
Each payload item yields a response:
{
"returnValue": 5,
"isError": true,
"errorMessage": "oops"
}
returnValue
: The return value of the method (optional).isError
: true if there was an error (optional).errorMessage
: The error message (optional).
- Relies heavily on undocumented behaviour.
- Various settings are applied asynchronously, with no apparent completion callback.
- Some settings crash.
- The availability of settings depends on the exact Windows version.
msbuild WindowsSettings.sln /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU"
Magic.