Batch-style variables to detect change in Cygdrive

Monte Cabet jolly.anarchist@gmail.com
Mon Aug 9 03:52:00 GMT 2010


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



More information about the Cygwin mailing list