View Full Version : WinXP command line / batch file help

05-30-2004, 01:05 AM
1. an audio based program I use unfortunatly has no default name which files are saved to after conversion, so when i use a cmd FOR statement:

for %f in (*.shn) do shorten -x %f %f.wav

the files are saved as filename.shn.wav

edit: Ive recently discovered that I made a mistake, and just using the first %f without specifying the output file name defaults it correctly with filename.wav. I still would like to know if theres an answer to this question though:

When I try to rename all the files in the folder to just *.wav, it wont work though. the cmd options ive tried are

ren *.shn.wav *.wav
ren *.shn.* *.*

and variables of them. I can see why its not working, since its recognizing the file as a *.wav already and therefor not changing anything, but its a bit frustrating. Is there any way I can use a cmd option to get rid of the extranius filename?

edit 2: theres no real need to anser this as i found the way to avoid it completely, but if youre willing to take a crack at it anyway go nuts :)

2. Im familiarizing myself with command line options, but im not still not 100% on batch files. Is there a way I can include multiple FOR statements in one batch file? for example:

for %%f in (*.shn) do shorten -x %%f %%f.wav
for %%f in (*.wav) do flac --delete-input-file -V -8 %%f

the && command doesnt seem to work with joining those statements, so is there a way to run it + other FOR statements concurently?

edit: for now I just created seperate batch files for each FOR statement and created a batch file that joins each of those batch files concurently. Id still like to know if i can do it in one file though.

edit 2: didnt know i could pipe the two actions, so now my batch file looks like this, and also includes a workaround to question 1.

edit 3: found the answer! it now looks like this:

@echo off
for %%f in (*.shn) do shorten -x %%f - | flac -V -8 -o %%~nf.flac -
if errorlevel 1 goto error
if errorlevel 0 del *.shn

3. is there an easier way via C++? :p (im a programming n00b)