Reputation: 8350
I am writing a batch file to execute the command (to execute Bitvise SFTP)
start cmd /k sftpc [SERVERNAME] -pk=1
After which the command prompt ask the following
Accept and (S)ave/(A)ccept for This Session/(C)ancel (S/A/C)?
Now the batch file should execute the next command as "A" to go through process.
I want automate the process of providing input "A" in command prompt. How can a batch file execute commands continuously ?
Updated :
After accepting the session, there are two more commands that needs to be executed,
cd [RemoteLocation]
get *.*
How to automate these two commands after the first two commands using the same batch file ?
Upvotes: 0
Views: 4365
Reputation: 207345
You could try this to send an "A
" to sftpc
:
start cmd /k "echo A | sftpc [SERVERNAME] -pk=1"
I don't have sftpc
and am just trying a suggestion to help out...
Updated:
If you have multiple commands to give to sftpc
, you may find that one of the following methods works, depending on how sftpc
works - I am working blind here - still don't have, or want, sftpc.
start cmd /k "echo A & echo cd somewhere & echo get *.* | sftpc [SERVERNAME] -pk=1"
... change "somewhere" to wherever you want to go to.
Or maybe:
Save the following in a file called ftp.cmd
A
cd somewhere
get *.*
Then try:
start cmd /k "sftpc [SERVERNAME] -pk=1 < ftp.cmd"
Upvotes: 3