I have a server application running called TerrariaServer.exe and I want to be able to send it commands with separate batch file. TerrariaServer.exe is a program running as a command line. How could I "feed" it a command such as "save" and "exit"? The answer might be pipes, but I'm not too sure. Here is kinda what I executed in a batch file while TerrariaServer.exe was running...
@echo off
echo save | TerrariaServer.exe
echo exit | TerrariaServer.exe
After that, nothing happen. I don't know if you need to know this but this is a video game server and the "save/exit" commands come with it.
Eep, use type for multiline input!
will open up TerrariaServer.exe and send "save" as input to it.
will open up TerrariaServer.exe and send "exit" as input to it.
See the problem yet? :P
You're executing TerrariaServer.exe twice!
You should use the command type. You can type a text document into the input of an executable. First, let's create this text document (or any file for that matter; the extension doesn't matter!)
Now let's type this into TerrariaServer.exe...
Maybe delete somefile.txt after we're done?
Hope that cleared things up! :)