Solved Need to change color accent with task scheduler

WickedSick

New Member
Local time
2:51 AM
Posts
7
Thread starter
Hello.
Recently I've been using a task in task scheduler, which automatically changes my "theme" from dark to light/light to dark.
i wanted to have color accent changed too, alongside of this.
i created one with creativity (I codded it at the bottom of the post) but only works for title bars, and taskbar doesn't seem to change.
Any ideas? i'd be really glad if you help me guys.
I've added codes below:

Auto-dark mode code which works:
Code:
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0 -Type Dword -Force; New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force;
Auto-dark mode code PLUS changing accent to a specified color(only works for Title bars)
Code:
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0 -Type Dword -Force; New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force; New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent -Name AccentColorMenu -Value 4282927692 -Type Dword -Force; New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent -Name StartColorMenu -Value 4282927692 -Type Dword -Force; New-ItemProperty -Path HKCU:SOFTWARE\Microsoft\Windows\DWM -Name AccentColor -Value 4282927692 -Type Dword -Force
 
Windows Version
Windows 10

My Computer

System One

  • Operating System
    Windows 10

FreeBooter

Active Member
Member
VIP
Local time
1:21 AM
Posts
266
Location
Turkey
I have a batch script that will do that.
 

Attachments

  • DarkTheme.bat
    1.7 KB · Views: 32

My Computer

System One

  • Operating System
    Windows 10 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Gigabyte Technology Co., Ltd.
    CPU
    QuadCore Intel Core i5-6600
    Motherboard
    Gigabyte GA-Z170M-D3H
    Memory
    Corsair Vengeance LPX CMK8GX4M1A2666C16
    Graphics Card(s)
    Sapphire Radeon R9 380
    Sound Card
    Realtek ALC892
    Monitor(s) Displays
    Samsung SyncMaster U28E590
    Hard Drives
    Sata SSD
    Internet Speed
    25Mbps
    Browser
    Firefox
    Antivirus
    Windows Defender

FreeBooter

Active Member
Member
VIP
Local time
1:21 AM
Posts
266
Location
Turkey
Have you test the commands one at a time to make sure they work?
 

My Computer

System One

  • Operating System
    Windows 10 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Gigabyte Technology Co., Ltd.
    CPU
    QuadCore Intel Core i5-6600
    Motherboard
    Gigabyte GA-Z170M-D3H
    Memory
    Corsair Vengeance LPX CMK8GX4M1A2666C16
    Graphics Card(s)
    Sapphire Radeon R9 380
    Sound Card
    Realtek ALC892
    Monitor(s) Displays
    Samsung SyncMaster U28E590
    Hard Drives
    Sata SSD
    Internet Speed
    25Mbps
    Browser
    Firefox
    Antivirus
    Windows Defender

FreeBooter

Active Member
Member
VIP
Local time
1:21 AM
Posts
266
Location
Turkey

My Computer

System One

  • Operating System
    Windows 10 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Gigabyte Technology Co., Ltd.
    CPU
    QuadCore Intel Core i5-6600
    Motherboard
    Gigabyte GA-Z170M-D3H
    Memory
    Corsair Vengeance LPX CMK8GX4M1A2666C16
    Graphics Card(s)
    Sapphire Radeon R9 380
    Sound Card
    Realtek ALC892
    Monitor(s) Displays
    Samsung SyncMaster U28E590
    Hard Drives
    Sata SSD
    Internet Speed
    25Mbps
    Browser
    Firefox
    Antivirus
    Windows Defender

WickedSick

New Member
Local time
2:51 AM
Posts
7
Thread starter
Thank you, but this isn't what i meant.
Let me explain you more:
I want to have a cmd command to edit tile bars and accent colors to a desired color.
So, i'd be able to use it, and create a task in "Task scheduler". then, whenever the task being launched, tile bars and accent color changes to the colors i set.
 

My Computer

System One

  • Operating System
    Windows 10

FreeBooter

Active Member
Member
VIP
Local time
1:21 AM
Posts
266
Location
Turkey
Hopefully other members able to help you.
 

My Computer

System One

  • Operating System
    Windows 10 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Gigabyte Technology Co., Ltd.
    CPU
    QuadCore Intel Core i5-6600
    Motherboard
    Gigabyte GA-Z170M-D3H
    Memory
    Corsair Vengeance LPX CMK8GX4M1A2666C16
    Graphics Card(s)
    Sapphire Radeon R9 380
    Sound Card
    Realtek ALC892
    Monitor(s) Displays
    Samsung SyncMaster U28E590
    Hard Drives
    Sata SSD
    Internet Speed
    25Mbps
    Browser
    Firefox
    Antivirus
    Windows Defender

johngalt

Well-known member
WQ Insider
Member
VIP
Local time
6:21 PM
Posts
620
Location
3rd Rock
Use HEX values.


Although this might have changed, in looking at the same values in my own computer, I see that the values are available in HEX or DEC, but this Stack Overflow post (and other places I looked) seem to indicate that manual entry via a batch command requires the values to be HEX only.

However, I did a little further digging, and this SPiceWorks post has a batch file that converts given values from decimal to HEX and then can be used to insert into DWORD locations, allowing you to easily edit the batch file with your own decimal values and let the batch file always automatically convert to HEX prior to assigning to the DWORD value, if you plan to change the values used by your task scheduler item on a regular basis.


If you are not changing those values often, simply calculate the HEX equivalents of your decimal values and replace the dec values with the HEX values and you should be good to go.
 

My Computer

System One

  • Operating System
    Windows 10 Pro X64
    Computer type
    PC/Desktop
    Manufacturer/Model
    The Beast Model A (homebrew)
    CPU
    AMD Ryzen 9 3950X
    Motherboard
    MSI MEG X570 GODLIKE
    Memory
    4 * Corsair Vengeance 32 GB 3600 MHz
    Graphics Card(s)
    eVGA GeForce GTX 970 SSC ACX 2.0 (04G-P4-3979-KB)
    Sound Card
    Realtek® ALC1220 Codec
    Monitor(s) Displays
    2 * Lenovo LT2323pwA Widescreeen @ 1920*1080
    Hard Drives
    3x Sabrent Rocket PCIe Gen4 NVMe M.2 1 TB SSD (SB-ROCKET-NVMe4-1TB)
    SanDisk Ultra SDSSDHII-960G-G25 960 GB SATA III SSD
    Crucial MX100 CT256MX100SSD1 256GB SATA III SSD
    2 * Seagate Barracuda 7200.12 ST31000528AS 1TB 7200 RPM (Old storage)
    PSU
    PC Power & Cooling’s Silencer Series 1050 Watt, 80 Plus Platinum
    Case
    Fractal Design Define 7 XL Dark ATX Full Tower Case
    Cooling
    NZXT KRAKEN Z73 73.11 CFM Liquid CPU Cooler + Air (3 * 140mm fans from case)
    Keyboard
    SteelSeries Apex Pro Wired Gaming Keyboard
    Mouse
    Logitech MX Master 3 Wireless Laser Mouse(shared)
    Internet Speed
    AT&T Lightspeed Gigabit duplex
    Browser
    Nightly|Chrome|Canary|Edge+ (Chromium) (in all 4 flavors)
    Antivirus
    Windows Defender + MB 4

WickedSick

New Member
Local time
2:51 AM
Posts
7
Thread starter
Use HEX values.


Although this might have changed, in looking at the same values in my own computer, I see that the values are available in HEX or DEC, but this Stack Overflow post (and other places I looked) seem to indicate that manual entry via a batch command requires the values to be HEX only.

However, I did a little further digging, and this SPiceWorks post has a batch file that converts given values from decimal to HEX and then can be used to insert into DWORD locations, allowing you to easily edit the batch file with your own decimal values and let the batch file always automatically convert to HEX prior to assigning to the DWORD value, if you plan to change the values used by your task scheduler item on a regular basis.


If you are not changing those values often, simply calculate the HEX equivalents of your decimal values and replace the dec values with the HEX values and you should be good to go.
Thank you for your reply.
But still, it doesn't work. i really want this code to work but it doesn't.
I've converted my dec value to hex value: FF484A4C
so my code been like:
Code:
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent -Name AccentColorMenu -Value FF484A4C -Type Dword -Force; New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent -Name StartColorMenu -Value FF484A4C -Type Dword -Force; New-ItemProperty -Path HKCU:SOFTWARE\Microsoft\Windows\DWM -Name AccentColor -Value FF484A4C -Type Dword -Force
but it still doesn't work. it gives me 0x1 code in task scheduler, and the accent color doesn't change a bit.
I've attached the screenshot too.

Any helps would be appreciated.

p.s: Are those codes enough for changing the accent and windows menu color?
I've seen them changing when i switch to another color with "Windows Setting", but not quite sure if they're the correct ones.
 

Attachments

  • 22222.jpg
    22222.jpg
    201.4 KB · Views: 35

My Computer

System One

  • Operating System
    Windows 10

johngalt

Well-known member
WQ Insider
Member
VIP
Local time
6:21 PM
Posts
620
Location
3rd Rock
As for the codes, I'm honestly not sure. This might require a deeper dive into figuring out which registry entries actually change, depending upon which parameters you change in Windows settings.

As for the Hex not working - something is off to begin with. I'm not sure where to go with this. I suppose the first place to go is this

Are you always going to use the same colors, or change it up every now and again?

Reason I ask is that, while TS cannot directly enter a .REG file, it can call a Batch file that *does* enter a .REG into the registry. So, instead of trying to do it all from the batch, set up the colors, export that reg key(s) as reg file(s) (and if multiple are required, be sure to combine them into a single .REG file), change the colors to your alternate setting, export again to a new name, and then set TS entries for 2 diff bat - once for loading one of the .REG entries and the other for loading the other.

In the first link, there is a post on how to add the .REG file into the registry using a batch file, and also, the very bottom shows the structure of the .REG file itself.

The actual beauty of doing it this way is that you can do this for numerous color combinations, not just 1, or 2, and really get into the customization, without actually having to write out a batch file for adding items to the registry natively, and worrying about the code structure, copying / pasting the exactly correct values, etc.

What do you think?
 

My Computer

System One

  • Operating System
    Windows 10 Pro X64
    Computer type
    PC/Desktop
    Manufacturer/Model
    The Beast Model A (homebrew)
    CPU
    AMD Ryzen 9 3950X
    Motherboard
    MSI MEG X570 GODLIKE
    Memory
    4 * Corsair Vengeance 32 GB 3600 MHz
    Graphics Card(s)
    eVGA GeForce GTX 970 SSC ACX 2.0 (04G-P4-3979-KB)
    Sound Card
    Realtek® ALC1220 Codec
    Monitor(s) Displays
    2 * Lenovo LT2323pwA Widescreeen @ 1920*1080
    Hard Drives
    3x Sabrent Rocket PCIe Gen4 NVMe M.2 1 TB SSD (SB-ROCKET-NVMe4-1TB)
    SanDisk Ultra SDSSDHII-960G-G25 960 GB SATA III SSD
    Crucial MX100 CT256MX100SSD1 256GB SATA III SSD
    2 * Seagate Barracuda 7200.12 ST31000528AS 1TB 7200 RPM (Old storage)
    PSU
    PC Power & Cooling’s Silencer Series 1050 Watt, 80 Plus Platinum
    Case
    Fractal Design Define 7 XL Dark ATX Full Tower Case
    Cooling
    NZXT KRAKEN Z73 73.11 CFM Liquid CPU Cooler + Air (3 * 140mm fans from case)
    Keyboard
    SteelSeries Apex Pro Wired Gaming Keyboard
    Mouse
    Logitech MX Master 3 Wireless Laser Mouse(shared)
    Internet Speed
    AT&T Lightspeed Gigabit duplex
    Browser
    Nightly|Chrome|Canary|Edge+ (Chromium) (in all 4 flavors)
    Antivirus
    Windows Defender + MB 4

WickedSick

New Member
Local time
2:51 AM
Posts
7
Thread starter
As for the codes, I'm honestly not sure. This might require a deeper dive into figuring out which registry entries actually change, depending upon which parameters you change in Windows settings.

As for the Hex not working - something is off to begin with. I'm not sure where to go with this. I suppose the first place to go is this

Are you always going to use the same colors, or change it up every now and again?

Reason I ask is that, while TS cannot directly enter a .REG file, it can call a Batch file that *does* enter a .REG into the registry. So, instead of trying to do it all from the batch, set up the colors, export that reg key(s) as reg file(s) (and if multiple are required, be sure to combine them into a single .REG file), change the colors to your alternate setting, export again to a new name, and then set TS entries for 2 diff bat - once for loading one of the .REG entries and the other for loading the other.

In the first link, there is a post on how to add the .REG file into the registry using a batch file, and also, the very bottom shows the structure of the .REG file itself.

The actual beauty of doing it this way is that you can do this for numerous color combinations, not just 1, or 2, and really get into the customization, without actually having to write out a batch file for adding items to the registry natively, and worrying about the code structure, copying / pasting the exactly correct values, etc.

What do you think?
Thanks for your answer.
After a lot of digging and using an app named Regshot, comparing two snapshots of my registry, I'm finally able to do the job.
(I explained everything in the bottom for anyone who was in the same issue)
The only problem is, my output is a .bat file.
since i elevate it with Highest permission(Admin) in the task scheduler, could this lead to a security hole in the future? or any thing to worry or its totally safe?



For those who need codes, here is an example:
Open up notepad, and paste these lines:
Then save it as a .reg file.
(Change the paragraph in "[ ]s" to yours, use Regedit.exe)

Code:
Windows Registry Editor Version 5.00

[HKEY_USERS\S-1-xxxx\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent]
"AccentPalette"=hex:9b,9a,99,00,84,83,81,00,6d,6b,6a,00,4c,4a,48,00,36,35,33,\
  00,26,25,24,00,19,19,19,00,10,7c,10,00
"StartColorMenu"=dword:ff333536
"AccentColorMenu"=dword:ff484a4c

[HKEY_USERS\S-1-xxxx\SOFTWARE\Microsoft\Windows\DWM]
"AccentColor"=dword:ff484a4c
"ColorizationColor"=dword:c44c4a48
"ColorizationAfterglow"=dword:c44c4a48

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize]
"SystemUsesLightTheme"=dword:0
"AppsUseLightTheme"=dword:0
 
Last edited:

My Computer

System One

  • Operating System
    Windows 10

johngalt

Well-known member
WQ Insider
Member
VIP
Local time
6:21 PM
Posts
620
Location
3rd Rock
Technically, not really, since the batch file itself would have to be manipulated in order to cause problems - and to do so would require access to your system in a manner that allowed direct access to the TS in the first place - at which point you've already got a much larger problem lol.

TS is designed, by default, to allow (and program installers, and the OS itself) to run tasks with elevated privileges, and is secure enough for your purposes. That doesn't mean don't use security, of course - just that in order to be used as any sort of real attack vector, a malicious actor would need (real) access in the first place - either by compromising your system directly, or indirectly, through, say, a malicious install routine masquerading as a legitimate one.

I'm grossly oversimplifying, there, but you get the idea.

As for RegShot - I should have mentioned it and I completely forgot - great little utility for injecting .REG snippets into your machine partially or wholly. Good call.
 

My Computer

System One

  • Operating System
    Windows 10 Pro X64
    Computer type
    PC/Desktop
    Manufacturer/Model
    The Beast Model A (homebrew)
    CPU
    AMD Ryzen 9 3950X
    Motherboard
    MSI MEG X570 GODLIKE
    Memory
    4 * Corsair Vengeance 32 GB 3600 MHz
    Graphics Card(s)
    eVGA GeForce GTX 970 SSC ACX 2.0 (04G-P4-3979-KB)
    Sound Card
    Realtek® ALC1220 Codec
    Monitor(s) Displays
    2 * Lenovo LT2323pwA Widescreeen @ 1920*1080
    Hard Drives
    3x Sabrent Rocket PCIe Gen4 NVMe M.2 1 TB SSD (SB-ROCKET-NVMe4-1TB)
    SanDisk Ultra SDSSDHII-960G-G25 960 GB SATA III SSD
    Crucial MX100 CT256MX100SSD1 256GB SATA III SSD
    2 * Seagate Barracuda 7200.12 ST31000528AS 1TB 7200 RPM (Old storage)
    PSU
    PC Power & Cooling’s Silencer Series 1050 Watt, 80 Plus Platinum
    Case
    Fractal Design Define 7 XL Dark ATX Full Tower Case
    Cooling
    NZXT KRAKEN Z73 73.11 CFM Liquid CPU Cooler + Air (3 * 140mm fans from case)
    Keyboard
    SteelSeries Apex Pro Wired Gaming Keyboard
    Mouse
    Logitech MX Master 3 Wireless Laser Mouse(shared)
    Internet Speed
    AT&T Lightspeed Gigabit duplex
    Browser
    Nightly|Chrome|Canary|Edge+ (Chromium) (in all 4 flavors)
    Antivirus
    Windows Defender + MB 4

WickedSick

New Member
Local time
2:51 AM
Posts
7
Thread starter
Technically, not really, since the batch file itself would have to be manipulated in order to cause problems - and to do so would require access to your system in a manner that allowed direct access to the TS in the first place - at which point you've already got a much larger problem lol.

TS is designed, by default, to allow (and program installers, and the OS itself) to run tasks with elevated privileges, and is secure enough for your purposes. That doesn't mean don't use security, of course - just that in order to be used as any sort of real attack vector, a malicious actor would need (real) access in the first place - either by compromising your system directly, or indirectly, through, say, a malicious install routine masquerading as a legitimate one.

I'm grossly oversimplifying, there, but you get the idea.

As for RegShot - I should have mentioned it and I completely forgot - great little utility for injecting .REG snippets into your machine partially or wholly. Good call.
I see.
I use Windows Security itself, and im kinda strict on installing apps over the internet, so i think as you said, there wouldn't be a comprimise to my acess to drives ==> access CMD or TS.
Thank you for your help, i think problem is solved now.
 

My Computer

System One

  • Operating System
    Windows 10
Top