Created
January 3, 2014 19:26
-
-
Save jameswebb68/8244719 to your computer and use it in GitHub Desktop.
Returns the Windows file details for any file using Cygwin bash (actual r-click-properties-info) to the term. ex:
finfo notepad.exe
finfo "C:\windows\system32\notepad.exe" finfo /cygdrive/c/Windows/System32/notepad.exe finfo "/cygdrive/c/Program Files/notepad.exe" finfo ../notepad.exe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#get file details from windows via wmic wmi formatted call | |
finfo() { | |
[[ -e "$(cygpath -wa "$@")" ]] || { echo "bad-file"; return 1; } | |
echo "$(wmic datafile where name=\""$(echo "$(cygpath -wa "$@")" | sed 's/\\/\\\\/g')"\" get /value)" |\ | |
sed 's/\r//g;s/^M$//;/^$/d' | awk -F"=" '{print $1"=""\033[1m"$2"\033[0m" }' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment