escape "~" in the substitution part
Make UAC finally work
make sure s:msg is not empty before trying to access it
small improvements for sudo.cmd batch script