Parse a unique version from a file and mkdir

Microsoft XP
November 15, 2010 at 14:34:31
Specs: Windows XP, 2.99 Ghz, 3.21 Ram
I have a process where I need to make a directory based on a version in a file name of an .exe. I need to parse that version out, make a directory of that version, and copy the latest version to that directory. the problem I am getting below is that the .exe is also created in the mkdir command. What would be the best way to grab the version number(3.5.3.0) from the file name?

@echo on
for /f %%F in ('dir/b/a-d UCSeCSUpdate3.5.3.0.exe') do call :sub1 %%F
goto :eof

:sub1
set name=%1
md C:\UCSEUpdates\%name:~12,18%
copy %* C:\UCSEUpdates\%name:~12,18%


See More: Parse a unique version from a file and mkdir

Report •


#1
November 16, 2010 at 08:39:17
Nothing? Need more info? Any ideas?

Report •

#2
November 18, 2010 at 07:12:20
Required reading:
SET /?
(Try %name:~12,7%)

for /f %%F in ('dir/b/a-d UCSeCSUpdate3.5.3.0.exe') do call :sub1 %%F
is equivalent to

call :sub1 UCSeCSUpdate3.5.3.0.exe

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question