delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/03/14/13:05:06

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,SPF_HELO_PASS,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: carolus <worwor AT bellsouth DOT net>
Subject: Re: How to read thumb drive volume label
Date: Mon, 14 Mar 2011 12:04:36 -0500
Lines: 27
Message-ID: <illhr5$l71$1@dough.gmane.org>
References: <4D7E200C DOT 40707 AT bellsouth DOT net> <0105D5C1E0353146B1B222348B0411A209DAA1008C AT NIHMLBX02 DOT nih DOT gov>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.14) Gecko/20110221 Thunderbird/3.1.8
In-Reply-To: <0105D5C1E0353146B1B222348B0411A209DAA1008C@NIHMLBX02.nih.gov>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On 3/14/2011 11:11 AM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
> Charles Russell sent the following at Monday, March 14, 2011 10:03 AM
>> Is there some way to read the volume label on a USB flash drive?
>> Something like blkid in linux?
>
> Something like this?
>
> function label() {
>      $(cygpath --sysdir)/cmd /c dir ${1}:\\ | \
>          tr \\r \\n | \
>          sed -n -e '1s/^ Volume in drive . is //p'
>      }
>
> Or you could play with
>
> $(cygpath --sysdir)/label.exe
>
> Note that both require that one provides the drive letter.
>
> I hope this was not OT.  I apologize for use of tools that come
> with Windows, but sometimes I find native tools to be easiest.
>
> - Barry
>    Disclaimer: Statements made herein are not made on behalf of NIAID.
>
Thanks. I didn't realize that the output of dir depended on whether it 
was invoked from cygwin or from cmd, and I didn't know about label.exe.


--
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