Computing.Net > Forums > Programming > Simple Batch File

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Simple Batch File

Reply to Message Icon

Name: c2kelly
Date: August 24, 2009 at 01:30:43 Pacific
OS: Windows XP
Subcategory: Batch
Tags: batch, xcopy, wavgen, DOS
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: gtaion
Date: August 24, 2009 at 21:09:36 Pacific
Reply:

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 row

So that sound like the basic flow of how you want this thing to work?


0

Response Number 2
Name: c2kelly
Date: August 24, 2009 at 22:47:44 Pacific
Reply:

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!!


0

Response Number 3
Name: klint
Date: August 25, 2009 at 07:53:14 Pacific
Reply:

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.


0

Response Number 4
Name: gtaion
Date: August 25, 2009 at 17:19:08 Pacific
Reply:

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 batch

set wshshell = createobject("Wscript.shell")
wshshell.run "cmd /k wavgen"
wscript.sleep 1000
WshShell.SendKeys "."&"0"&"5"
WshShell.SendKeys "{ENTER}"
WshShell.Sendkeys "%{f4}"


0

Response Number 5
Name: Razor2.3
Date: August 25, 2009 at 17:24:46 Pacific
Reply:

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.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Simple Batch File

Simple Batch file www.computing.net/answers/programming/simple-batch-file/10948.html

Need help to make a simple batch file www.computing.net/answers/programming/need-help-to-make-a-simple-batch-file/20286.html

simple batch file prog q.. www.computing.net/answers/programming/simple-batch-file-prog-q/14278.html