Solved

Relatively Simple DOS Batch Script...

Posted on 2004-08-13
3
264 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 50 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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 …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now