1.

Solve : How to send an already active program commands through a batch file??

Answer»

I've been working on getting this server running all night, and I could spend the next several hours typing in each command I want it to do ONE at a time and would need to do that again the next time, however I FEEL that there's an easier way. I've spent about an hour looking through commands and other peoples advice, but I haven't seen anything close enough that I could USE.

So I have the server up and running. It is now awaiting commands. Is there a way to tell it to type out all the other commands I need it to do with a batch file?

I have a text file of all the commands I'd like it to do, I just don't know how to get them all in there in a time efficient way. For /f "delims=" %A in (YOURFILE.ext) do %A

This will take each line of YOURFILE.ext and pass that line to cmd to run. If you have your commands formatted DIFFERENTLY, please post the format so someone can edit the syntax to work. (This will only work on basic text files, so no .doc or such.)Each command is a new line with just Quote

echo <command>

It's very simple. I have it saved as a txt at the moment, but changing that to an ext isn't an issue.Sendkeys in a VBS script or AutoIt can both enter text into active program windows.Not sure if you can do that via .BAT... but I use AutoHotkey for that.

http://www.autohotkey.com/docs/commands/Send.htm

The scripts are really easy to write. I can paste a little sample if you'd like... or you can look in their archives I believe.

- kyle_engineer


Discussion

No Comment Found