I am having trouble trying to convert a windows path into the cygwin-style linux like path. C:\path\to\file will be /cygdrive/c/path/to/file for instance. I have everything working except for converting the uppercase drive letter pulled out of the path to lowercase. The link everyone gives for these questions is:
http://www.robvanderwoude.com/battech_convertcase.php
and the for loop under "SET, Take Two" seemed the most appropriate. This is what I have so far:
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET CWRSYNCHOME=%~dp0
echo the windows path is %CWRSYNCHOME%
for /f "tokens=1,2 delims=:" %%a in ("%CWRSYNCHOME%") do (
set "manip1=%%a"
set "manip2=%%b"
echo starts as /cygdrive/!manip1!!manip2:\=/!
FOR %%i IN ("A=a" "B=b" "C=c" "D=d" "E=e" "F=f" "G=g" "H=h" "I=i" "J=j" "K=k" "L=l" "M=m" "N=n" "O=o" "P=p" "Q=q" "R=r" "S=s" "T=t" "U=u" "V=v" "W=w" "X=x" "Y=y" "Z=z") DO SET "manip1=%manip1:!%%i!%"&echo doing: "manip1=%manip1:!%%i!%"&echo now its !manip1!
set "CYGLIKEHOME=/cygdrive/!manip1!!manip2:\=/!"
)
echo the converted path is %CYGLIKEHOME%
PAUSE
GOTO :EOF
The output I get is:
the windows path is E:\cwRsync_5.5.0_x86_Free\SANDBOX\
starts as /cygdrive/E/cwRsync_5.5.0_x86_Free/SANDBOX/
the converted path is /cygdrive/ "manip1="
now its "manip1="
now its "manip1="
now its "manip1="
now its "manip1="
now its "manip1="
now its "manip1="
now its "manip1="
now its "manip1="
now its "manip1="
now its "manip1="
now its "manip1="
now its "manip1="
now its /cwRsync_5.5.0_x86_Free/SANDBOX/
Press any key to continue . . .
is there a better way to convert a single char to lowercase? If not, can you guys see what I'm doing incorrectly when setting CYGLIKEHOME?
Thank you