In msys bash in Windows, I'd like to cd to the directory a (Windows native) .lnk links to. These are the standard Windows shortcuts. I want to be able to do this:
~ $ cdlnk programs.lnk
/c/Program\ Files/ $
I've come this far:
strings "$lnk" | grep -A 1 DATA | tail -n 1
gives me the path the shortcut links to. However, now I'm stuck. I can either
- Make an alias in .bashrc - but then I cannot use pipes or pass the parameter to a script, i.e. I cannot run above code.
- Make a script cdlnk.sh - but then I can only change its cd and not that of the calling shell.
.bashrc
or a file that gets sourced in there.