This is the mail archive of the
cygwin
mailing list for the Cygwin project.
windows file info
- From: Jon Retting <jon at retting dot com>
- To: cygwin at cygwin dot com
- Date: Sun, 5 Jan 2014 14:36:41 -0800
- Subject: windows file info
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jon Retting <jon at retting dot com>
Hello,
Hacked up this one liner function for getting a files actual windows details/properties information. I needed a tertiary way to compare executable/drivers, so a version number from windows seemed like a viable option. Hopefully someone will find this handy, seeing as i feel so guilty for not contributing more to such a wonderful project like Cygwin. So appreciative of the maintainers and everyone else associated with the CYGWIN project. My email for some reason keep getting rejected by the list, so the level of praise goes up with each revision.
#get file details from windows via wmic wmi formatted call condensed
finfo() { [[ -f "$(cygpath "$@")" ]] || { 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"}';}
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
There is no doubt the brilliant people here could have done a better job, but like i said, i just needed to contribute something. And if you are a gamer you might appreciate this https://github.com/jonretting/geforce-driver-check
Cheers,
JR
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple