delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/08/08/23:52:41

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
Message-ID: <4C5F7B79.60805@gmail.com>
Date: Sun, 08 Aug 2010 20:52:25 -0700
From: Monte Cabet <jolly DOT anarchist AT gmail DOT com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Batch-style variables to detect change in Cygdrive
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

Is there anyway I can get batch-style relative drive paths in Cygwin? An 
example of what I mean is "%~d0". The reason for is is that I would like 
to mount folders from a USB, so the drive (the variable I showed does 
drive) will change everytime I plug the USB in. After abit of playing 
around I found how to mount folders, but it needs be ran from inside 
Cygwin via a file ran on start-up or written manually. I am attempting 
to set the mounts from a batch script or atleast get a variable/function 
that will find out what drive to use. Below is some examples I've cooked up.

# batch-style
set "mono1=cygpath --type windows "%~d0\mono\""
set "mono2=cygpath --type mixed "%~d0/mono/""
set "mono3=cygpath --type unix "/cygdrive/%~d0/mono/""
mount -o binary '%mono1%' /mnt

# Cygwin-style
mount -o binary "$(cygpath --type windows "%~d0\mono\)" /mnt
mount -o binary "$(cygpath --type mixed "%~d0/mono/)" /mnt
mount -o binary "$(cygpath --type unix /cygdrive/%~d0/mono/)" /mnt



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