In my previous place of employment, I wrote numerous shell scripts that do what you want without Expect or
. I accomplished this by using key based authentication instead of passwords. I am sure the same would be possible with a batch file. If you need help creating and configuring key based authentication, you can look at