Build Your Own Arcade Controls Forum
Main => Software Forum => Topic started by: vibez on July 11, 2005, 02:53:44 pm
-
Basically I have a program that needs to be run from a batch file or commandline.
It converts several files into 1 large one.
The format of the command line is (minus the brackets)
[output.qch] [input1.cod] [input2.cod] [input.3cod] etc....
I have a folder of about 1000 .cod files. I dont fancy typing that all out on a commandline.
Is there a way to create some batch file that will get the name of all the .cod files & feed it into a commandline like the one above? All the input.cod files need to be on one line
I tried
output.qch *.cod
but it moans about the *
-
Is this Windows or elsewhere?
If windows, do the following:
In the directory that has the .cod files from a command line do:
dir /B *.cod >c:\filename.txt
Where filename.txt is the path/output file you want.
This will give you just a listing of the filenames.
Next, create a batch file with the following:
FOR /f "tokens=1 delims=;" %%l in (c:\filename.txt) DO output.qch %%l
although, I dunno if that'll work since I have not idea what a qch file is but this works very well for other purposes.
-
Yes it is unders windows.
I get this error
"%%l was unexpected at this time."
Can I email you the files for you to test with?
-
Ok I have it almost working now :) :)
Only trouble is that it is not putting all the input.cod names on one line, but is feeding them to the program 1 at a time like the example below
FOR /F "tokens=1 delims=;" %l in (c:\filename.txt) do cod2qch output.qch %l
this is the result
C:\cod2qch output.qch input1.COD
C:\cod2qch output.qch input2.COD
C:\cod2qch output.qch input3.COD
C:\cod2qch output.qch input4.COD
-
Oh I see.
Do you have MS Word?
Cut and past the list from the text file into MS Word.
Select Edit, Replace (Might be search & replace)
In the find section, input ^p
In the replace section, push your spacebar once.
Hit replace all.
This should take all the files and remove the return carriage and then put a space between each of them.
You can then cut and past into a new batch file with your call.
-
Thanks ever so much. That worked perfect :)
Is there no way to modify the batch so we dont need the use a word editor?
-
There are all kinds of text editors that can detect and modify the special characters such as a carriage return. As long as the editor can detect the formatting, you should be able to use what you like. Word just came to mind because it's what I use regularly.
Scripting the whole thing is possible, but considering the amount of time it takes just to do a quick find and replace, I don't know that it's worth it.
-
That is very true. I guess we dont even need the batch file once we have the filename directed to a text file. It just would of been nice if there was a way in dos to add each line from the text file into just one line.
Thanks again. Atleast you have saved me having to type out all the file names :)
-
Download SimpleFileJoiner.exe.
Select all the files you want, select sort list (to make sure they're in alphabetical order), and select join. Done!
-
Download SimpleFileJoiner.exe.
Select all the files you want, select sort list (to make sure they're in alphabetical order), and select join. Done!
Thanks but i'm not sure how that would help. The program I'm writing the batch for converts multiple files into a different format then encrypts them all into a big file. I don't think a file joiner is the answer here.
Although it does look like it will come in handy for other projects :)