Batch Script Or PowerShell: How To Read/fetch The Setting Values Of [Start > Settings > Personalization > Taskbar > Turn System Icons On Or Off]?
Introduction
In this article, we will explore how to read and fetch the setting values of specific system icons on the Windows 10 Taskbar using both Batch Script and PowerShell. The system icons in question are the "Location", "Action Center", and "Touch Keyboard" icons. We will delve into the Windows Registry to retrieve the necessary information and display it in the Command Line Interface (CLI).
Understanding the Windows Registry
The Windows Registry is a database that stores settings and options for the operating system and applications. It is a hierarchical structure that consists of keys, subkeys, and values. In this case, we will be working with the following registry path:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects
This path contains the settings for the Taskbar system icons. We will use the reg
command in PowerShell to query the registry and retrieve the necessary values.
Batch Script Approach
Batch Script is a command-line scripting language that allows you to automate tasks and execute commands. We can use the reg
command in Batch Script to query the registry and retrieve the necessary values. Here is an example of how to do it:
@echo off
setlocal enabledelayedexpansion
:: Set the registry path
set "reg_path=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects"
:: Query the registry and retrieve the values
for /f "tokens=2*" %%a in ('reg query "%reg_path%" /v Location') do set "location=%%b"
for /f "tokens=2*" %%a in ('reg query "%reg_path%" /v ActionCenter') do set "action_center=%%b"
for /f "tokens=2*" %%a in ('reg query "%reg_path%" /v TouchKeyboard') do set "touch_keyboard=%%b"
:: Display the values
echo Location: !location!
echo Action Center: !action_center!
echo Touch Keyboard: !touch_keyboard!
This Batch Script will query the registry and retrieve the values for the "Location", "Action Center", and "Touch Keyboard" system icons. It will then display the values in the CLI.
PowerShell Approach
PowerShell is a task automation and configuration management framework from Microsoft. We can use the Get-ItemProperty
cmdlet in PowerShell to query the registry and retrieve the necessary values. Here is an example of how to do it:
# Set the registry path
$reg_path = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects"

$location = (Get-ItemProperty -Path action_center = (Get-ItemProperty -Path touch_keyboard = (Get-ItemProperty -Path $reg_path -Name TouchKeyboard).TouchKeyboard
Write-Host "Location: $location"
Write-Host "Action Center: $action_center"
Write-Host "Touch Keyboard:touch_keyboard"
This PowerShell script will query the registry and retrieve the values for the "Location", "Action Center", and "Touch Keyboard" system icons. It will then display the values in the CLI.
Conclusion
In this article, we explored how to read and fetch the setting values of specific system icons on the Windows 10 Taskbar using both Batch Script and PowerShell. We used the Windows Registry to retrieve the necessary information and display it in the CLI. The Batch Script approach used the reg
command to query the registry and retrieve the values, while the PowerShell approach used the Get-ItemProperty
cmdlet to achieve the same result. Both approaches can be used to automate tasks and execute commands in Windows.
Additional Tips and Variations
- To retrieve the values for all system icons on the Taskbar, you can modify the registry path to
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\*
. - To display the values in a more readable format, you can use the
Format-Table
cmdlet in PowerShell or theecho
command with the/t
option in Batch Script. - To automate the process of retrieving the values, you can schedule the script to run at a specific time or interval using the Task Scheduler in Windows.
References
- Microsoft Docs: Windows Registry
- Microsoft Docs: Batch Script
- Microsoft Docs: PowerShell
Batch Script or PowerShell: How to Read/Fetch the Setting Values of [Start > Settings > Personalization > Taskbar > Turn system icons on or off]? - Q&A ===========================================================
Q: What is the Windows Registry and how does it relate to the Taskbar system icons?
A: The Windows Registry is a database that stores settings and options for the operating system and applications. It is a hierarchical structure that consists of keys, subkeys, and values. The registry path HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects
contains the settings for the Taskbar system icons.
Q: How do I use Batch Script to query the registry and retrieve the values for the Taskbar system icons?
A: You can use the reg
command in Batch Script to query the registry and retrieve the values. Here is an example of how to do it:
@echo off
setlocal enabledelayedexpansion
:: Set the registry path
set "reg_path=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects"
:: Query the registry and retrieve the values
for /f "tokens=2*" %%a in ('reg query "%reg_path%" /v Location') do set "location=%%b"
for /f "tokens=2*" %%a in ('reg query "%reg_path%" /v ActionCenter') do set "action_center=%%b"
for /f "tokens=2*" %%a in ('reg query "%reg_path%" /v TouchKeyboard') do set "touch_keyboard=%%b"
:: Display the values
echo Location: !location!
echo Action Center: !action_center!
echo Touch Keyboard: !touch_keyboard!
Q: How do I use PowerShell to query the registry and retrieve the values for the Taskbar system icons?
A: You can use the Get-ItemProperty
cmdlet in PowerShell to query the registry and retrieve the values. Here is an example of how to do it:
# Set the registry path
$reg_path = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects"
$location = (Get-ItemProperty -Path action_center = (Get-ItemProperty -Path touch_keyboard = (Get-ItemProperty -Path $reg_path -Name TouchKeyboard).TouchKeyboard
Write-Host "Location: $location"
Write-Host "Action Center: $action_center"
Write-Host "Touch Keyboard: $touch_keyboard"
Q: Can I retrieve the values for all system icons on the Taskbar?
A: Yes, you can modify the registry path to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\*
to retrieve the values for all system icons on the Taskbar.
Q: How can I display the values in a more readable format?
A: You can use the Format-Table
cmdlet in PowerShell or the echo
command with the /t
option in Batch Script to the values in a more readable format.
Q: Can I automate the process of retrieving the values?
A: Yes, you can schedule the script to run at a specific time or interval using the Task Scheduler in Windows.
Q: What are some additional tips and variations for retrieving the values?
A: Some additional tips and variations include:
- Using the
reg
command with the/v
option to query the registry and retrieve the values for a specific key. - Using the
Get-ItemProperty
cmdlet with the-Name
option to query the registry and retrieve the values for a specific key. - Using the
Format-Table
cmdlet to display the values in a more readable format. - Scheduling the script to run at a specific time or interval using the Task Scheduler in Windows.
Q: Where can I find more information about the Windows Registry and Batch Script/PowerShell?
A: You can find more information about the Windows Registry and Batch Script/PowerShell on the following websites:
- Microsoft Docs: Windows Registry
- Microsoft Docs: Batch Script
- Microsoft Docs: PowerShell