winure/scripts/userprofile.sh

10 lines
406 B
Bash
Executable file

#!/usr/bin/bash
# absolutely monstrous string hackery
# get %USERPROFILE% using cmd and convert that path
USERPROFILE=`/mnt/c/Windows/System32/cmd.exe '/C' 'echo %USERPROFILE%' 2> /dev/null`
USERPROFILE=${USERPROFILE//\\//} # replace '\' separators with '/'
USERPROFILE=/mnt/c/${USERPROFILE#C:/} # replace 'C:/' with '/mnt/c/'
USERPROFILE=${USERPROFILE%$'\r'} # strip carriage return
echo $USERPROFILE