Jump to content

Recommended Posts

Posted

Hello, I am trying to create a simple batch program to create a Playlist here is what I have so far

@echo off
dir *.mp3 *.wma *.wmv *.avi /b >"0playlist.m3u"
ren "0playlist.m3u" "00 %cd%.m3u"

My end goal is to have the playlist be the same name as folder that it is in, so for example, if I put the batch file in a folder named "Rammstein - Mutter" than the playlist that gets created would be "Rammstein - Mutter.m3u"

the 00 in the output name are there only to have the playlist at the top when sorted by name.

what I need is to replace %cd% with something that will just give me just the folder name as a veritable output, as %cd% gives me the full path. (ex. "c:\users\public\music\Rammstein - Mutter\")

creating the playlist works exactly the way I want it to it is only a problem with the ren (rename) part of it.

Thanks for any help that you can give.

And yes I have google'd it but the only thing I was able to come up with was %~dp1 which basically does the same thing.

----------------------

Reason For Edit : Clarification of my end goal

Posted

Thanks, Here is the final code.

@echo off
Call :FOLDER %CD%
GoTo :EOF
:FOLDER
Set MyCurDir=%~n1
dir *.mp3 *.wma *.wmv *.avi /b >"plist.m3u"
ren "plist.m3u" "00 %~n1.m3u"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...