2 Replies - 1112 Views - Last Post: 17 December 2009 - 12:34 PM Rate Topic: -----

#1 Candio  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 11-August 09

batch file for-looping

Post icon  Posted 29 November 2009 - 02:22 PM

Hello,

I'm trying to get a batch file put together to create a namelist input file for a fortran prog. Pretty much all I need to do is create this [short] input file and call the fortran prog several times, each time with a variable in the input file changed. I also tell the fortran prog where to dump the output. Here's what I got so far, but because i am new to batch files, I'm not sure what I'm doing wrong. Can anybody see why this wouldn't work?

@echo off

FOR %%tcloud IN (0 1 5) DO (
echo ^&INPUT > INPUT
echo   tcloud=%%tcloud >> INPUT
echo   zcloud=8 >> INPUT
echo   nre=10 >> INPUT
echo   idatm=4 >> INPUT
echo   sza=95 >> INPUT
echo   wlinf=4 >> INPUT
echo   wlsup=20 >> INPUT
echo   wlinc=-.01 >> INPUT
echo   iout=1 >> INPUT
echo / >> INPUT

echo Data for tcloud=%%tcloud >> output.dat
sbdart >> output.dat


)


Is This A Good Question/Topic? 0
  • +

Replies To: batch file for-looping

#2 Krisx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 14-December 09

Re: batch file for-looping

Posted 16 December 2009 - 09:25 PM

Hey, doesn't look like there are many Batch file genius's on here. I actually first started programming in batch, but have forgotten a lot of what I know.
http://www.masterjakeonline.com/
I'd check out this site. You can learn a lot of batch just reading around.

This post has been edited by Krisx: 16 December 2009 - 09:26 PM

Was This Post Helpful? 0
  • +
  • -

#3 Krisx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 14-December 09

Re: batch file for-looping

Posted 17 December 2009 - 12:34 PM

Also I don't think you can have %%tcloud a variable like that.

%%a to %%z and %%A to %%Z

one letter. :D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1