Hi,

Does anyone know how to send commands to a shell that is already opened?

I know how to open the shell to run a command, but how do I send another command to it?

Here is what I can do

Shell("C:\Backup\mysqlbackup.bat")

This command runs the mysqldump command. But the mysqldump command needs a password to execute.

How would I go about automatically sending the password to it?

Thanks in advance
Sam

Use findwindow to get the handle of the window and then use SendMessage with WM_SETTEXT const. (You can't supply this info in the bat file?)


Good Luck

Give up shell, you have to start new process by API call, get stdin and stdout handle and you can send/read there commands directly. It can look difficult but it is piece of cake - all what you need is several api calls.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.