# Batch File Help ... XCOPY?



## c2kelly (Aug 24, 2009)

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


----------



## Squashman (Apr 4, 2003)

In theory really no need to use xcopy in this instance but that is just me. 
Why prompt for the input of 0.05 if you know it should be 0.05.


```
del "c:\some folder\accelerogram.dat"
copy "c:\some folder\a1.dat" "c:\some folder2\accelerogram.dat"
start "" "c:\program files\wavgen\wavgen.exe"
set /p _input=Enter your value:
del "c:\some folder\c1.dat"
copy "c:\some folder\compatible.dat" "c:\some folder2\c1.dat"
```


----------



## c2kelly (Aug 24, 2009)

Thank you so much! Yeah, looks painfully basic =)

I actually need the program to read 0.05 and press enter for the program to run on it's own. I've been reading about coding keystrokes, but it seems to me like there has to be an easier way.

I've tried a few things, but nothing's worked yet.


----------



## scrfix (May 3, 2009)

For your keystrokes, I am not sure about coding that in a batch however you can code it in AUTOIT, compile it into an EXE and call that from a batch file. It is extremely easy from what I was reading.
Check out the following forum post about it:
http://www.tek-tips.com/viewthread.cfm?qid=1059299&page=4


----------



## Squashman (Apr 4, 2003)

You would need to SendKeys in a Vbscript. 
Is this input to your wavgen program?


----------



## Squashman (Apr 4, 2003)

Scancode is another option. It is a 3rd party utility you would have to put on your computer though.
http://www.simtel.net/free/Keyboard-utilities/scncd500zip/3741.html


----------

