The title says it all. How to change the background color of the console window a .lnk opens programmatically?
For example, using my script from my previous answer:
This creates a shortcut on desktop:
$shortcutpath = "$homedesktop$name.lnk" $wshshell = new-object -comobject wscript.shell $shortcut = $wshshell.createshortcut($shortcutpath) $shortcut.targetpath = $path $shortcut.save()
This makes the shortcut start the program elevated:
$bytes = (system.io.file)::readallbytes($shortcutpath) $bytes(0x15) = $bytes(0x15) -bor 0x20 (system.io.file)::writeallbytes($shortcutpath,$bytes)
I used this code to pin PowerShell 7.1.1 to taskbar:
pintotaskbar.ps1 "C:Program FilesPowerShell7pwsh.exe::PowerShell 7.1.1"
It pins “Administrator: PowerShell 7.1.1” to taskbar, however background color of the window it opens is black, I would like it to have PowerShell “noble blue” RGB(1,36,86) as background color, I know the GUI way to do this:
How can I achieve the same result with a command?
Since all information about the shortcut is stored in the .lnk file, and I can make the shortcut elevated by changing a byte, it should also be possible to change the background color by changing three bytes in the .lnk file…
The problem is: I don’t know which bytes to change.
Thank you for your help.