Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Relatively Simple DOS Batch Script...

Posted on 2004-08-13
3
Medium Priority
?
273 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

730 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