Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm new to the batch file world and am in
desperate help for something I'm sure is very
basic.I need to copy a .txt file into the folder that
contains my DOS program (called wavgen)
and rename it accelerogram.dat so that
wavgen can read it. The program has to be
started, and an input of 0.05 has to be
entered. Then the output file compatible.dat
needs to be copied as/ saved as a different
name. I'll be repeating this code, so if I need 5
runs of the program, there will be five repeats
of this, and the xcopy should basically dump
input into the accelerogram.dat file and save
the output from the compatible.dat file into a
separate file with a new name.ERASE accelerogram.dat
XCOPY A1.dat to accelerogram.dat (?
confused how to code this)
START wavgen
Somehow prompt an input of 0.05
XCOPY compatible.dat to C1.dat (? again
confused)Any help with any portion of this would be
greatly appreciated. Thanks!!CK

So you want to delete the existing accelerogram.dat file
rename A1.dat to accelerogram.dat
START wavgen
echo .05
rename compatible.dat to C1.dat?
and then do that 5 times in a rowSo that sound like the basic flow of how you want this thing to work?

My main issue is getting the program to read 0.05 ...
everything else is working now. So when the program starts,
it automatically reads the .dat files required, and then asks
for a damping ratio. So I have to type 0.05 and then press
enter for the program to continue. I've tried just placing the
value 0.05 after "start wavgen" on the same line, on the next
line, etc.Nothing..
Thanks for your help!!

Try this:
echo 0.05|wavgen
The pipe character (|) runs the command to the left of it and makes its output the input of the command to the right of it. It may or may not work, depending on how wavgen gets its input.

I like Klint's solution if it works, the problem is not knowing anything about this wavgen app it's hard to tell you a solution. What I'm thinking is, instead of calling wavgen from the batch, have it call a .vbs that opens wavgen then sends the keys you want. Save the following, editing how you need and add
call wscript "the .vbs file" to your batchset wshshell = createobject("Wscript.shell")
wshshell.run "cmd /k wavgen"
wscript.sleep 1000
WshShell.SendKeys "."&"0"&"5"
WshShell.SendKeys "{ENTER}"
WshShell.Sendkeys "%{f4}"

WshShell.SendKeys "."&"0"&"5"
Don't do this. ".05" is much easier to read, and executes faster.wshshell.run "cmd /k wavgen"
Don't use .Run(), use .Exec(). Exec() gives you access to the job's StdIn.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |