Romhacking.net
Romhacking => Newcomer's Board => Topic started by: Nyxos on May 29, 2013, 08:50:09 am
-
Hello and Good Day,
I would like to create a batch file, wich I dont know how to make (n00b!). I am not much familiar on MSDOS Commands but on the contrary I only know a small portion of it.
The format would be this:
Legend: Program = prg, SourceFile = sf, Output = out
prog sf out
I would like to input a lot of source files "sf01.mp sf02.mp sf03.mp... and-so-on" that would retain their original filenames but with a "_dec" on the end of the filename. Thank You
Regards,
Nyxos
-
Normally you would write the for loop by hand on the command line to take care of the exact naming convention you want, as a throwaway. Well, you would if the shell were sane, which is pretty much exactly what the Windows/DOS shell is not. In a Unix-style shell this would easily be a one-liner. In bash, I would write:
for i in `seq -w 1 99`; do prog sf${i}.mp sf${i}_dec.mp
No such luck with the Windows shell; the required code is long and complicated enough you wouldn’t want to try doing this without putting in a file first (and I wouldn’t want to try wasting like 30 minutes writing the equivalent script such that it won’t break anything, being that I’m not sitting at a Windows box...). If it were very important that it run on an end user’s computer, that’d be another matter, but if it’s just for you I seriously urge installing something that’s going to make this go down better, such as MSYS (which comes with bash and would be a reasonably gentle introduction to Unix commands, a sort of gateway drug to being a full on command line warrior) or Windows PowerShell (which I personally know nothing about but everyone says it’s way better than the default so I’ll trust them on that one).
-
Are you running this in DOS, or in Windows?
Windows Vista and Windows 7 include a command called "FORFILES" which would be very useful in this case.
-
I am running Windows 7 (not mine) atm. I would like to run it. As stated on my main post I don't really have much knowledge on MSDOS.
Thank you for the codes BRPXQZME, but I require the code on MSDOS (Windows Shell), I don't possess a PC that can run a Virtual Machine to run the code on a Unix system for now (PC is slow as heck). As for Cygwin and Mysis, I don't want to install such programs on this PC cause its not mine, though I have them on my Laptop but my LT has a busted Backlight which in turn I cannot use :). Anyways thank you for the replies, though I really require that program :)
Regards,
Nyxos
-
I would like to run it. As stated on my main post I don't really have much knowledge on MSDOS.
You can always learn. ;D
FORFILES is ingeniously straightforward. It looks like all you need is
FORFILES /c "cmd /c prog @file @fname_dec.@ext"
For every file in the current directory, this will run the command
prog [filename].[ext] [filename]_dec.[ext]
The alternative would be to throw something together with Excel (or some other spreadsheet) using its string-concatenation functions. Ugly, but it works.
-
You can always learn. ;D
FORFILES is ingeniously straightforward. It looks like all you need is
FORFILES /c "cmd /c prog @file @fname_dec.@ext"
For every file in the current directory, this will run the command
prog [filename].[ext] [filename]_dec.[ext]
The alternative would be to throw something together with Excel (or some other spreadsheet) using its string-concatenation functions. Ugly, but it works.
Is this the code?
FORFILES /c "cmd /c prog @file @fname_dec.@ext"
i would like to run the program through all the files with a extension .fv and then the output files would have a *_dec.fv added to their filenames as the output, sorry for being a n00b at this ;D.
EDIT: Solved!
Figured it out myself with your format @Jorpho-san, here's what I did
FORFILES /p *path/folder of the sourcefiles* /c "cmd /c
progam.exe @file @fname_dec.@ext"
I thank you for helping me a lot. :)
Regards,
Nyxos
-
Are you running this in DOS, or in Windows?
Windows Vista and Windows 7 include a command called "FORFILES" which would be very useful in this case.
AHA! Never heard of that one. Yes, that is a much better command; it just got added around the time I quit heavy Windows usage. m(_ _)m
-
AHA! Never heard of that one. Yes, that is a much better command; it just got added around the time I quit heavy Windows usage. m(_ _)m
I am also surprised that a command such as that exist xD or is it just me not knowing better xDxD. Thank you also for your help
-
Apart that putting "multifile rename" in google would teach you everything this guys told you,
you would had found many window (free) tools to do this. Here some examples:
http://www.efsoftware.com/mr/e.htm (http://www.efsoftware.com/mr/e.htm)
http://www.bulkrenameutility.co.uk/Main_Intro.php (http://www.bulkrenameutility.co.uk/Main_Intro.php)
http://www.advancedrenamer.com/ (http://www.advancedrenamer.com/)
-
Personally, I use Bulk Rename Utility since I don't need to change mp3 tags. The GUI is a bit overwhelming at first.
-
No, I didn't require any Batch Renaming Utility. I needed a Batch file to run my program through various files and output them as their generic filename with a *_dec added to it. Sorry for not making this clear.