Batch script help

Status
Not open for further replies.

SiNNER

Member
23
2011
0
0
First of all i am 100% noob for batch script... I am using Sabnzbd for downloading from usenet and in that prog i have option to run .bat script after download... Now i need simple .bat script which will rename .wmv or .mp4 file in folder to the same name as download folder... Can anyone help me?

Thanks in advance...
 
6 comments
You can make it a bat or cmd extension ..

Code:
set mydir="%~p0"
set mydir=%mydir:\=;%
set mydir=%mydir: =:%
set LAST=%LAST::= %
ren *.mp4 %LAST%.*
ren *.wmv %LAST%.*
 
Its not working i get this error :

C:\Program Files (x86)\SABnzbd>set mydir="\DOCUME~1\ADMINI~1\Desktop\Scripts\"

C:\Program Files (x86)\SABnzbd>set mydir=";DOCUME~1;ADMINI~1;Desktop;Scripts;"

C:\Program Files (x86)\SABnzbd>set mydir=";DOCUME~1;ADMINI~1;Desktop;Scripts;"

C:\Program Files (x86)\SABnzbd>set LAST=:=

C:\Program Files (x86)\SABnzbd>ren *.mp4 := .*
The syntax of the command is incorrect.

C:\Program Files (x86)\SABnzbd>ren *.wmv := .*
The syntax of the command is incorrect.

But thanks for try...
 
if that programs creates a new folder each time use this code:
Code:
@echo OFF
set mydir="%~p0"
SET mydir=%mydir:\=;%

for /F "tokens=* delims=;" %%i IN (%mydir%) DO call :LAST_FOLDER %%i
goto :EOF

:LAST_FOLDER
if "%1"=="" (
    @echo %LAST%
    goto :REN_FILES
)

set LAST=%1
SHIFT

goto :LAST_FOLDER
:REN_FILES
ren *.mp4 %LAST%.*
ren *.wmv %LAST%.*
 
Status
Not open for further replies.
Back
Top