use PowerShell to reset the system clock

I have a dual boot Windows 10 Pro/Ubuntu 18 laptop. Every time I reboot from Ubuntu to Windows, Windows sets my system clock ahead by  8 hours and says it is California time.

I am a Windows Insider, and I complained about this bug for several years with no results. I guessed that Windows PowerShell would be able to control the clock. A Google search gave me a link to a detailed description of the Set-Date command: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/set-date?view=powershell-6

An example showed exactly how to adjust the system clock. Execute PowerShell in administrative mode:

PS C:\WINDOWS\system32> set-date  -adjust  -8:0:0
Saturday, March 16, 2019 1:39:17 AM
PS C:\WINDOWS\system32>
This magic one-liner saves me a lot of time.

myenv package update

The Windows Subsystem for Linux home page is set with this command:

export LHOME=”$(wslhome)”

If you don’t have permission to access $LHOME, the home page was previously set to the last directory name which you do have permission to access.

The updated wslhome command prints the correct home page even if you don’t have permission to access it. If access is desired, you must use Administrator privilege to give yourself access to the later directories in the path.

myenv package for Windows 10 + Cygwin + WSL/Ubuntu

Windows 10 can run two Linux subsystems simultaneously: Cygwin and Ubuntu. I developed a small package of commands (myenv.zip) to conveniently access files from all three operating systems. It creates five environment variables

myOS — Cygwin or GNU/Linux

myDRIVE — install drive of Windows 10

WHOME — Windows home directory

CHOME — Cygwin home directory

LHOME — Ubuntu home directory

Just add “.  myenv” to your .profile and you can access files like this:

$WHOME/OneDrive     (Microsoft cloud store)

$CHOME/KE/bin/ke.exe     (my Knowledge Explorer)

$LHOME/../../rootfs/etc/shadow     (to delete forgotten password)

There’s one caveat: Microsoft has a complex scheme for buffering $LHOME (Windows file system) and $HOME (Ubuntu file system). Don’t try to access $LHOME until you exit the Ubuntu terminal window.

The myenv package includes three other useful commands:

path — prints each $PATH directory on separate line

wordpad — example command not found in $PATH directory

mkzip — zip all files in directory and its subdirectories

To install the free myenv package, download http://ContextKnowledgeSystems.org/download/myenv.zip and unzip in any directory in $PATH. I suggest using directory $myDRIVE/bin or /usr/local/bin or $HOME/bin.