how can i split (with a batch script) Download-URLs like
[with slash]
a) http://www.someone.com/download/files/filename.exe
b) http://www.someone other.com/some files/filename 1.exe (with spaces !)
[with backslash]
c) http:\\www.someone.com\download\files\filename.exe
d) http:\\www.someone other.com\some files\filename 1.exe (with spaces !)
[mixed slash and backslash]
e) http:\\www.someone.com/download\files/filename.exe
f) http://www.someone other.com\some files/filename 1.exe (with spaces !)
and all of the above when there is no HTTP part (starting with "www.")
into the (Base-)URL part and the filename part.
One batch script for all variations (and for more than one variable - in a Loop) would be nice :-)
Something like:
setlocal EnableDelayedExpansion
For %%G in (var1, var2, var3) do (
set /A COUNT+=1
... routine to split "var1", "var2" and "var3" into temporary variables BASEURL and FILENAME
set Folder!COUNT!=%BASEURL%
set Name!COUNT!=%FILENAME%
)
Output:
For /L %%A in (1,1,3) do (
echo URL: !Folder%%A! --- FIILENAME: !Name%%A!
)