Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
@echo off
for /f "delmis=" %%i in ('dir /s /a-d /b 盘符:\s.h.e*') do if "%%~xi" neq ".wma" ren "%%i" %%~ni.wma
Originally posted by zw19750516 at 2008-7-12 13:24:
@echo off
for /f "delmis=" %%i in ('dir /s /a-d /b s.h.e*') do if "%%~xi" neq ".wma" ren "%%i" %%~ni.wma
Originally posted by yywd at 2008-7-12 13:40:
Thanks for your reply, but it doesn't seem to work
@echo off
for /r %%i in (*s.h.e*) do if "%%~xi" neq ".wma" ren "%%i" %%~ni.wma
Originally posted by zw19750516 at 2008-7-12 13:42:
Where did you put it to run?
Try this:
@echo off
for /r %%i in (*s.h.e*) do if "%%~xi" neq ".wma" ren "%%i" %%~ni.wma
ps: the one in post #2 ...
@echo off&setlocal enabledelayedexpansion
for /r %%i in (*s.h.e*) do (
set str=%%~nxi&set str=!str:s.h.e=she!
ren "%%i" !str!
)
for /r %%i in (*she*) do if "%%~xi" neq ".wma" ren "%%i" "%%~ni.wma"
Originally posted by zw19750516 at 2008-7-12 14:20:
I understand now, the problem is with the . in s.h.e. This should work now, right:
@echo off&setlocal enabledelayedexpansion
for /r %%i in (*s.h.e*) do (
set str=%%~nxi&set str=!str:s.h. ...
@echo off&setlocal enabledelayedexpansion
for /r %%i in (*s.h.e*) do (
set "str=%%~i"
if /i not "!str:~-4!"==".wma" move /y "%%i" "%%i.wma"
)
pause@echo off
for /f "delims=*" %%i in ('dir /s /a-d /b *s.h.e*^|findstr /i /e /v ".wma"') do move /y "%%i" "%%i.wma"
pause