This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Batch-style variables to detect change in Cygdrive
- From: Monte Cabet <jolly dot anarchist at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Sun, 08 Aug 2010 20:52:25 -0700
- Subject: Batch-style variables to detect change in Cygdrive
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