#!/usr/bin/env zsh local cmd=${commands[cmd.exe]:-/mnt/c/Windows/System32/cmd.exe} [[ -x $cmd ]] || return case "$(/dev/null)//$'\r'}}") local keys=(${lines%%=*}) vals=(${lines#*=}) typeset -grA z4h_win_env=(${keys:^vals}) local home=$z4h_win_env[USERPROFILE] [[ -n $home ]] || return if [[ $home != [a-zA-Z]':\'* || ( ! -d ${home::=/mnt/${(L)home[1]}/${${home:3}//\\//}} && ! -d ${home::=${home#/mnt}} ) ]]; then home=$(command wslpath -- $z4h_win_env[USERPROFILE] 2>/dev/null) || return [[ -d $home ]] || return fi typeset -gr z4h_win_home=$home