Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Relatively Simple DOS Batch Script...

Posted on 2004-08-13
3
Medium Priority
?
275 Views
Last Modified: 2010-08-05
I have an .exe that will convert a file of some type A (lets say *.flt) to some type B (lets say *.hpx).  
You just go to a command prompt and type: flt2hpx <inputfile> <outputfile>

What I want is some type of script that I can run that, for some directory, will convert all the files of type .flt to files of type .hpx with the same name (except the extension).

For example, doing the convertions individually by hand at the DOS prompt, I type:
C:> flt2hpx Brad_01.flt Brad_01.hpx
C:> flt2hpx something_04.flt something_04.hpx
.....
etc.

I want a script that will use the convert ALL the files in the given directory of type .flt to type .hpx like above.  Thanks!!

0
Comment
Question by:DiamonDogX
3 Comments
 
LVL 3

Expert Comment

by:aravindtj
ID: 11794059
Hi,
 Try this command.
ren *.flt *.hpx


If you want a script/ Batch file,

convert *.flt *.hpx    ; command example
------------------------------------
echo off
IF %1 == "" GOTO USAGE
IF %2 == "" GOTO USAGE

ren %1 %2
GOTO EXIT

:USAGE
echo "Usage: convert src_extension dest_extension

:EXIT
-----------------------------------------

All the best
0
 
LVL 2

Accepted Solution

by:
amg42 earned 200 total points
ID: 11794159
Create a .cmd file containing the following:

   @echo off
   for %%f in (*.flt) DO flt2hpx "%%f" "%%~nf.hpx"

Open a command shell, change to a directory containing your FLT files, and execute the script.
0
 
LVL 9

Expert Comment

by:DrWarezz
ID: 11794680
You should ask future MSDOS related questions at: Operating_Systems/MSDOS/

Anyway, for a batch file that does just what you want, you could do this:

::----8<-----------flt2hpx.bat ------------------::
@echo off

if [%1]==[] (
  echo Usage: flt2hpx.bat filename1 filename2
  exit /b
)
if [%2]==[] (
  echo Usage: flt2hpx.bat filename1 filename2
  exit /b
)

ren %1 %2
::----8<----------------end----------------------::

Usage of the above is:
flt2hpx.bat  Brad_01.flt  Brad_01.hpx

If that's not what you want, then specify a bit more, and I'm sure I/we could conjure up something. ;)

Good luck,
[r.D]
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Simple Linear Regression

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question