delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/12/30/03:23:05

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:subject:message-id:from:to:reply-to
:mime-version:content-type:content-transfer-encoding; q=dns; s=
default; b=dyT3ljbJVMauvOkAIRaZJwWb0r9Xux3eMVns0f/C+WTFEwVjCkWS7
jhS8hVfu5tMHt9cNRf8Jadt9iYenZr/CpOZHJCUnoeSJGYzmfNKFyRI5IVUY0kwH
4gI6e1ADOHNajMSMVL/z56GAh0hSOuf853jKiIPjl8HKamkc48ksLg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:subject:message-id:from:to:reply-to
:mime-version:content-type:content-transfer-encoding; s=default;
bh=j8owRy2qo5lGnPsMFeOVuhMQ0OU=; b=q1TPZ1FMrqQURyu6+R6yGaxgMJ7l
bFpidKbpQ0lu3t61n+e+Rl5KJkSzKejHolKyOPqku6KGyhor+qgLZTV4SQ90wXbP
H8qaSuSF4k8y9Kb0AbTCz90iEGagqjLxK8j+MOw2C5Xj1Ofmsv4C59w5oEZungIi
RJJ4ptDYkRuDwtw=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: Yes, score=5.5 required=5.0 tests=AWL,BAYES_50,RP_MATCHES_RCVD,SPF_PASS autolearn=no version=3.3.2
X-HELO: mail.retting.com
X-Footer: cmV0dGluZy5jb20=
Date: Mon, 30 Dec 2013 00:22:41 -0800
Subject: getting windows ntfs file info
Message-ID: <23cd37fc-ba40-4666-81a3-feb46ecfa658@retting.com>
From: Jon Retting <jon AT retting DOT com>
To: cygwin AT cygwin DOT com
Reply-To: Jon Retting <jon AT retting DOT com>
MIME-Version: 1.0
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id rBU8N0VH008854

Hello,
    Typed 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. And heck anything's better than that most recent dosshell thread :)

#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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019