neilpa/cmd-colors-solarized

Not work on Windows 1803

Opened this issue ยท 7 comments

After upgrade from Windows 1709 to 1803, the Ubuntu bash reverted to the original colors. So I run Update-Link.cmd C:\Windows\System32\bash.exe light again.
But it gave me the following errors.

D:\code\other\cmd-colors-solarized>Update-Link.cmd  C:\Windows\System32\bash.exe light
New-Object : Exception calling ".ctor" with "1" argument(s): "Error HRESULT E_FAIL has been returned from a call to a COM component."
At D:\code\other\cmd-colors-solarized\Get-Link.ps1:501 char:4
+    New-Object Huddled.Interop.ShellLink (Convert-Path $Path)
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:14 char:1
+ $lnk.ConsoleColors[0]="#002b36"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:15 char:1
+ $lnk.ConsoleColors[8]="#073642"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:16 char:1
+ $lnk.ConsoleColors[2]="#586e75"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:17 char:1
+ $lnk.ConsoleColors[6]="#657b83"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:18 char:1
+ $lnk.ConsoleColors[1]="#839496"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:19 char:1
+ $lnk.ConsoleColors[3]="#93a1a1"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:20 char:1
+ $lnk.ConsoleColors[7]="#eee8d5"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:21 char:1
+ $lnk.ConsoleColors[15]="#fdf6e3"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:22 char:1
+ $lnk.ConsoleColors[14]="#b58900"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:23 char:1
+ $lnk.ConsoleColors[4]="#cb4b16"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:24 char:1
+ $lnk.ConsoleColors[12]="#dc322f"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:25 char:1
+ $lnk.ConsoleColors[13]="#d33682"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:26 char:1
+ $lnk.ConsoleColors[5]="#6c71c4"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:27 char:1
+ $lnk.ConsoleColors[9]="#268bd2"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:28 char:1
+ $lnk.ConsoleColors[11]="#2aa198"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:29 char:1
+ $lnk.ConsoleColors[10]="#859900"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

The property 'PopUpBackgroundColor' cannot be found on this object. Verify that the property exists and can be set.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:38 char:5
+     $lnk.PopUpBackgroundColor=0x0
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

The property 'PopUpTextColor' cannot be found on this object. Verify that the property exists and can be set.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:39 char:5
+     $lnk.PopUpTextColor=0x1
+     ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

The property 'ScreenBackgroundColor' cannot be found on this object. Verify that the property exists and can be set.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:40 char:5
+     $lnk.ScreenBackgroundColor=0xf
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

The property 'ScreenTextColor' cannot be found on this object. Verify that the property exists and can be set.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:41 char:5
+     $lnk.ScreenTextColor=0x6
+     ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

You cannot call a method on a null-valued expression.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:44 char:1
+ $lnk.Save()
+ ~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Updated C:\Windows\System32\bash.exe to Solarized - light

D:\code\other\cmd-colors-solarized>

I can update link the following way successfully.
Update-Link.cmd "C:\Users\Liu.D.H\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Bash on Ubuntu on Windows.lnk" light

Getting this error as well when trying to update Powershell Colors. Mine reads similar:


New-Object : Exception calling ".ctor" with "1" argument(s): "Access is
denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Get-Link.ps1:501 char:4
+    New-Object Huddled.Interop.ShellLink (Convert-Path $Path)
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInv
   ocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Po
   werShell.Commands.NewObjectCommand

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:14 char:1
+ $lnk.ConsoleColors[0]="#002b36"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:15 char:1
+ $lnk.ConsoleColors[8]="#073642"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:16 char:1
+ $lnk.ConsoleColors[2]="#586e75"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:17 char:1
+ $lnk.ConsoleColors[6]="#657b83"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:18 char:1
+ $lnk.ConsoleColors[1]="#839496"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:19 char:1
+ $lnk.ConsoleColors[3]="#93a1a1"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:20 char:1
+ $lnk.ConsoleColors[7]="#eee8d5"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:21 char:1
+ $lnk.ConsoleColors[15]="#fdf6e3"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:22 char:1
+ $lnk.ConsoleColors[14]="#b58900"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:23 char:1
+ $lnk.ConsoleColors[4]="#cb4b16"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:24 char:1
+ $lnk.ConsoleColors[12]="#dc322f"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:25 char:1
+ $lnk.ConsoleColors[13]="#d33682"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:26 char:1
+ $lnk.ConsoleColors[5]="#6c71c4"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:27 char:1
+ $lnk.ConsoleColors[9]="#268bd2"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:28 char:1
+ $lnk.ConsoleColors[11]="#2aa198"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:29 char:1
+ $lnk.ConsoleColors[10]="#859900"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

The property 'PopUpBackgroundColor' cannot be found on this object. Verify
that the property exists and can be set.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:33 char:5
+     $lnk.PopUpBackgroundColor=0xf
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

The property 'PopUpTextColor' cannot be found on this object. Verify that
the property exists and can be set.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:34 char:5
+     $lnk.PopUpTextColor=0x6
+     ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

The property 'ScreenBackgroundColor' cannot be found on this object. Verify
that the property exists and can be set.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:35 char:5
+     $lnk.ScreenBackgroundColor=0x0
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

The property 'ScreenTextColor' cannot be found on this object. Verify that
the property exists and can be set.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:36 char:5
+     $lnk.ScreenTextColor=0x1
+     ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

You cannot call a method on a null-valued expression.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:44 char:1
+ $lnk.Save()
+ ~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull 

Going to investigate this more in the next day or two. Will post back here if I find anything

I Assume this is because PSReadLine has been updated to version 2.0.0. I was not able to find enough documentation in my limited time to understand how to fix this script, but that seems like the necessary next step.

https://www.powershellgallery.com/packages/PSReadLine/2.0.0-beta2

Firstly, I got error as same with you

PS C:\Users\mildronize\Desktop\cmd-colors-solarized-master> Get-ExecutionPolicy -List

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
+  CurrentUser    RemoteSigned
 LocalMachine       Undefined

I think It depends on your ExecutionPolicy.
In my case, I use RemoteSigned on CurrentUser

So, I need to unblock all ps1 files that involves with this script
powershell

Here is a file list that I already unblocked, (or other files you wish to run on your computer)

Get-Link.ps1
Update-Link.ps1
Set-SolarizedDarkColorDefaults.ps1
Set-SolarizedLightColorDefaults.ps1

P.S. Update-Link.ps1 will call Get-Link.ps1. So, Get-Link.ps1 should have a permission to run too

Or you can use other ExecutionPolicy for unblocking everything (I don't recommend)
Here is my result
2

And my Windows 10 Pro version is 1803
I hope it should be work for you too, have fun ๐Ÿ‘

There's a lot changing with respect to how the Windows 10 console works. I think if you are using Windows 10, the colortool is probably the right approach. With the colortool, you can modify it so the colors match the same as what this project tried to. As I recall the colortool scheme is slightly different in some shades, but in some ways it might be an improvement. Long term, the approach used with these scripts probably won't work with the new Terminal as it (thankfully) applies schemes in a different way. I think colortool might still work with it. You can find a few builds that people have made to experiment with. This project will remain applicable to the classical conhost terminal and shells, such as running cmd or PowerShell today, but it will hopefully be retired as the primary terminal window most people use in the next few releases. If you haven't seen it yet, look for the YouTube video announcing it at Build.

ColorTool is in a slightly different place now: https://github.com/microsoft/terminal/tree/master/src/tools/ColorTool

I had similar issues. The issue seems to be that the PSReadLine module doesn't like any changes to the properties of a shortcut via the Get-Link script

It would be very bad if they moved to the colortool, because it does not provide all the features of the the old Get-Link script. As for the new Terminal,... we will see when it comes.

Anyways, the solution is to downgrade the PSReadLine module to version 1.2. The 2.0.0-beta versions that ship with Windows 10 are really causing lots of issues and are far from stable. Have a look here for detailed instructions: https://github.com/stefaanc/psconsole#the-colors-of-the-console