Batch Command Prompt Program?

Soldato
Joined
22 Oct 2005
Posts
2,884
Location
Moving...
I've got several thousand files that I need to convert via the command prompt. Is there anyway I can do this in one go using some kind of program?
The command itself will be in the following format:
C:\ hgt2xyz N00W050.hgt > N00W050.txt
C:\ hgt2xyz N00W051.hgt > N00W051.txt
.....etc

I know basic C and Java if thats any good. Thanks for any advice.
 
I've got several thousand files that I need to convert via the command prompt. Is there anyway I can do this in one go using some kind of program?
The command itself will be in the following format:
C:\ hgt2xyz N00W050.hgt > N00W050.txt
C:\ hgt2xyz N00W051.hgt > N00W051.txt
.....etc

I know basic C and Java if thats any good. Thanks for any advice.

You can get fancy if you like, but here is a basic start:

You'll need a win32 copy of CUT.EXE in your path available here: http://sourceforge.net/projects/unxutils and other places


Code:
REM SAVE THIS AS BLEH.BAT AND RUN FROM DIRECTORY CONTAINING *.HGT FILES
DIR *.hgt /B | cut -d. -f1 > list.txt
FOR /F %%G IN (list.txt) DO hgt2xyz %%G.hgt > %%G.txt
DEL list.txt


EDIT: good reference for winXP/NT batch scripting : ss64.com
 
Last edited:
Something like this should get you started (replace the @Echo call with hgt2xyz), save as .bat:

Code:
@FOR %%A IN (*.hgt) DO @ECHO %%A %%A.txt
 
Last edited:
Back
Top Bottom