Batch Script Or PowerShell: How To Read/fetch The Setting Values Of [Start > Settings > Personalization > Taskbar > Turn System Icons On Or Off]?
Introduction
When working with Windows systems, it's often necessary to automate tasks or retrieve specific settings values. In this article, we'll explore how to use both Batch Script and PowerShell to read and fetch the setting values of the system icons under [Start > Settings > Personalization > Taskbar > Turn system icons on or off]. We'll focus on retrieving the values of "Location", "Action Center", and "Touch Keyboard" icons.
Understanding the Taskbar Settings
Before diving into the scripting part, let's understand the Taskbar settings. The Taskbar settings are located under [Start > Settings > Personalization > Taskbar > Turn system icons on or off]. This section allows users to customize the appearance of the Taskbar by enabling or disabling specific system icons.
Batch Script Approach
Batch Script is a command-line scripting language that allows you to automate tasks and interact with the Windows operating system. To read and fetch the setting values of the system icons using Batch Script, you'll need to use the Windows Registry API.
Step 1: Open the Registry Editor
First, you need to open the Registry Editor. You can do this by running the following command in the Command Prompt:
regedit
Step 2: Navigate to the Taskbar Settings Registry Key
Next, navigate to the following registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
Step 3: Retrieve the Setting Values
To retrieve the setting values of the system icons, you can use the following Batch Script code:
@echo off
setlocal enabledelayedexpansion
reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowLocationOnTaskbar" > nul
if %errorlevel% == 0 (
set "location=!errorlevel!"
) else (
set "location=0"
)
reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCaretOnTaskbar" > nul
if %errorlevel% == 0 (
set "action_center=!errorlevel!"
) else (
set "action_center=0"
)
reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTouchKeyboardButtonOnTaskbar" > nul
if %errorlevel% == 0 (
set "touch_keyboard=!errorlevel!"
) else (
set "touch_keyboard=0"
)
echo Location: !location!
echo Action Center: !action_center!
echo Touch Keyboard: !touch_keyboard!
This Batch Script code retrieves the setting values of the "Location", "Action Center", and "Touch Keyboard" icons and displays them in the Command Prompt.
PowerShell Approach
PowerShell is a powerful task automation and configuration management framework from Microsoft. To read and fetch the setting values of the system icons using PowerShell, you can use the following code:
# Retrieve the setting values of the system icons
location = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").ShowLocationOnTaskbar
$action_center = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").ShowCaretOnTaskbar
$touch_keyboard = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").ShowTouchKeyboardButtonOnTaskbar

Write-Host "Location: $location"
Write-Host "Action Center: $action_center"
Write-Host "Touch Keyboard: $touch_keyboard"
This PowerShell code retrieves the setting values of the "Location", "Action Center", and "Touch Keyboard" icons and displays them in the PowerShell console.
Conclusion
In this article, we've explored how to use both Batch Script and PowerShell to read and fetch the setting values of the system icons under [Start > Settings > Personalization > Taskbar > Turn system icons on or off]. We've covered the Batch Script approach, which involves using the Windows Registry API, and the PowerShell approach, which uses the Get-ItemProperty cmdlet to retrieve the setting values. Both approaches provide a way to automate tasks and interact with the Windows operating system.
Additional Tips and Variations
- To modify the setting values of the system icons, you can use the Set-ItemProperty cmdlet in PowerShell or the reg add command in Batch Script.
- To retrieve the setting values of other system icons, you can modify the registry key path and the value names in the Batch Script or PowerShell code.
- To automate tasks that involve modifying the setting values of the system icons, you can use the Task Scheduler in Windows or the Scheduled Tasks feature in PowerShell.
References
- Microsoft Docs: Windows Registry API
- Microsoft Docs: PowerShell Get-ItemProperty cmdlet
- Microsoft Docs: PowerShell Set-ItemProperty cmdlet
Batch Script or PowerShell: How to Read/Fetch the Setting Values of [Start > Settings > Personalization > Taskbar > Turn System Icons On or Off]? - Q&A ===========================================================
Introduction
In our previous article, we explored how to use both Batch Script and PowerShell to read and fetch the setting values of the system icons under [Start > Settings > Personalization > Taskbar > Turn system icons on or off]. In this Q&A article, we'll answer some common questions related to this topic.
Q: What is the purpose of the Taskbar settings?
A: The Taskbar settings are used to customize the appearance of the Taskbar by enabling or disabling specific system icons. This includes icons such as Location, Action Center, and Touch Keyboard.
Q: How do I access the Taskbar settings?
A: To access the Taskbar settings, follow these steps:
- Click on the Start button.
- Click on the Settings icon.
- Click on Personalization.
- Click on Taskbar.
- Click on Turn system icons on or off.
Q: What is the difference between Batch Script and PowerShell?
A: Batch Script and PowerShell are both command-line scripting languages used to automate tasks and interact with the Windows operating system. However, PowerShell is a more powerful and flexible language that provides a wider range of features and functionality.
Q: How do I use Batch Script to read and fetch the setting values of the system icons?
A: To use Batch Script to read and fetch the setting values of the system icons, you can use the following code:
@echo off
setlocal enabledelayedexpansion
reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowLocationOnTaskbar" > nul
if %errorlevel% == 0 (
set "location=!errorlevel!"
) else (
set "location=0"
)
reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCaretOnTaskbar" > nul
if %errorlevel% == 0 (
set "action_center=!errorlevel!"
) else (
set "action_center=0"
)
reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTouchKeyboardButtonOnTaskbar" > nul
if %errorlevel% == 0 (
set "touch_keyboard=!errorlevel!"
) else (
set "touch_keyboard=0"
)
echo Location: !location!
echo Action Center: !action_center!
echo Touch Keyboard: !touch_keyboard!
Q: How do I use PowerShell to read and fetch the setting values of the system icons?
A: To use PowerShell to read and fetch the setting values of the system icons, you can use the following code:
# Retrieve the setting values of the system icons
location = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").ShowLocationOnTaskbar
$action_center = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").ShowCaretOnTaskbar
$touch_keyboard = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").ShowTouchKeyboardButtonOnTaskbar
Write-Host "Location: $location"
Write-Host "Action Center: $action_center"
Write-Host "Touch Keyboard: $touch_keyboard"
Q: Can I modify the setting values of the system icons using Batch Script or PowerShell?
A: Yes, you can modify the setting values of the system icons using Batch Script or PowerShell. To do this, you can use the Set-ItemProperty cmdlet in PowerShell or the reg add command in Batch Script.
Q: Are there any other ways to automate tasks related to the Taskbar settings?
A: Yes, there are other ways to automate tasks related to the Taskbar settings. For example, you can use the Task Scheduler in Windows or the Scheduled Tasks feature in PowerShell to automate tasks that involve modifying the setting values of the system icons.
Conclusion
In this Q&A article, we've answered some common questions related to reading and fetching the setting values of the system icons under [Start > Settings > Personalization > Taskbar > Turn system icons on or off]. We've covered topics such as accessing the Taskbar settings, using Batch Script and PowerShell, and modifying the setting values of the system icons.