Batch File Help!

January 30, 2011 at 13:45:45
Specs: Windows 7
Ok this is difficult to explain but I would like to create a batch that executes a cmdline program and then uses a cmd of that program to create a directory with the file name it just ran.

@echo off
title pcutmp3
cd /d "C:\MY.JAVA"
java -jar pcutmp3.jar --cue %1 --dir "%~dp1\

So basicaly the above changes dir, runs the java cmdline cuesplitter wich splits the cue I dragged onto the batch and sticks the mp3 files in the path where the cue was.

What i want is it to stick the files in a new folder with the folder named same as the cue i just dropped on the batch.

--dir C:/Whatever

would create a directory in C:\ named Whatever

--cue specfies the .cue

This part needs changing --dir "%~dp1\ to make a new folder named after the cue file.

Sounds complex hope you can follow


See More: Batch File Help!

Report •

January 30, 2011 at 14:18:51
if not exist "%~d\n1" md "%~d\n1"
java -jar pcutmp3.jar --cue %1 --dir "%~d\n1\"

Report •

January 30, 2011 at 15:53:27
Thanks thats perfect! exactly what i wanted

Brillant, many many thanks :)

for some reason ic ouldnt get it to work with %~D, - Drive variable
so as it stands

@echo off
title pcutmp3
cd /d "%~dp1"
IF NOT EXIST "%~n1" md "%~n1"
cd /d "C:\MY.JAVA"
java -jar pcutmp3.jar --cue %1 --dir "%~dp1/%~n1"

I dunno if its all working but its cutting to a created subfolder named after the cue.
Really appreciate your help, saved my getting all frusrtated and reply was so fast.

Cant thankyou enough


Report •

January 31, 2011 at 03:33:36
Thank you for your warm feedback. Actually you solved the issue by yourself.

About the reason for %~d malfunction, that is my mistake. Sorry, last night (I live in Italy) I was in a rush. Here the correct code:

  if not exist "%~d1\%~n1" md "%~d1\%~n1"
  java -jar pcutmp3.jar --cue %1 --dir "%~d1\%~n1\"

Any char between variable modifiers (i.e. d, p, n, x etc...) breaks the modifier chain so you have to re-code the modifier prefix.


Report •

Related Solutions

Ask Question