i would like to get the name of the last repository. (Sorry for my language, i try to improve that too:) ).
My current directory is:
c:\users\ssdmax\Google Drive\Exercices\temp
i try to get "temp" as a string in a variable.
For that purpoose, a make a batch file:
Code: Select all
set cd1=%cd%
cd ..
set cd2=%cd%%
cd %cd1%
::thats command works and do the job, but depend of the example:
set "repert=%cd1:*Exercices\=%"
echo %repert%
:: %repert%=temp wonderful!!!
::what i would like, but doesnt work:
set"reperto=%cd1:cd2=%
The idea is to substitute the begining of the path with nothing to extract the last name:
cd1=c:\users\ssdmax\Google Drive\Exercices\temp
cd2=c:\users\ssdmax\Google Drive\Exercices
replace cd2 into cd1 with nothing should give me temp.
I hope i've been clear. Sorry again for my language. Thanks.
Max.
ps: my computer is w10 64 bits, i use DOS command to call my batch file.