HaloChris117 Posted January 11, 2009 Share Posted January 11, 2009 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 Quote Link to comment Share on other sites More sharing options...
Retro-Starr Posted January 11, 2009 Share Posted January 11, 2009 http://www.ss64.com/nt/syntax-args.html should help. Spread the word of this site. It's fucking awesome. It even helps for Bash scripting, Visual Basic, SQL Server, Oracle, and Powershell. Spread the word! Help the people! (like my 3rd time posting this site for batch help) Quote Link to comment Share on other sites More sharing options...
HaloChris117 Posted January 11, 2009 Author Share Posted January 11, 2009 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" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.