PSFTP Automation using batch file

Posted on 2009-05-06
Last Modified: 2013-12-09
I have been looking forever and I just cant make sense of the process to automate a process using batch files and psftp from windows 2k3 to an sftp site.
I was able to write a ssh script that opens the psft application, inputs the correct login sequence informatino and transfers the files. The only issue here is that it can only run when i am logged into the server. I need to be able to create batch files that will automate the process, but cant find too much information on the web to do this.
Any help would be greatly appreciated.

Thank You,
Question by:jsears1979
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 28

Expert Comment

ID: 24322884
in theory you can use the windows schedule to trigger this with no open session. Just specify which account should be used to start the task if specific rights are required, otherwise system account rights will be used. Normally everythin whihc can be lauched from the command line with no other user interaction can be launched this way; visible from the desktop depens on task parameters, and if a session is open. Ig no session is open errors will be logged in the event viewer.

Author Comment

ID: 24329856
Here is the process that I am currently using...
Batch file is scheduled to open psfp application, change the name of the file and run the ssh script that inputs the information into the psftp prompts. The ssh script inputs the correct information, deletes the file upon successful upload and exits/closes the psftp application. Again, this works flawlessly when I run it manually by double clicking the first batch file to kick off the whole process... the problem is that when I schedule it and it tries to run when I am not logged in, it cant open the psftp application. I have full admin rights to the server, so I do not think that is the issue. It is more an issue of getting an psftp session to run when I am not logged in.

LVL 28

Expert Comment

ID: 24330217
why don't you run psftp directly? why is ssh required to input "correct information" and delete a file?
this whole thing could be a regular shell script doing the "pre" and "post" steps, and call psftp in between with the right arguments?
have you tried to change the account starting the scheduled task or not?
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now


Author Comment

ID: 24338325
This is on a server and it needs to be a scheduled task to run in the evenings nightly. I cant run psftp directly unless i want to log into the server every night and open it. I use my account on the server which has complete admin priveleges. I have tried using another service account as well as1 other admin ID. The shell script would use the send keys command to type in the account and login information without a user having to do it.
LVL 28

Accepted Solution

lesouef earned 500 total points
ID: 24340318
I am not with you... as far as I know psftp can take all the parameters it needs from the command line arguments; so if you make a shell script of that, the scheduler should be able to do this, there is no need for keyboard entries or sendkeys. if its prompts for question, its because you are missing arguments like -pw

Expert Comment

ID: 34941454
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cloud file services can fill many different roles for your business. Often, the use of cloud file services begins with employees using consumer products, like Dropbox, to share files with customers and each other. While sync-and-share can be an effe…
This article shows how a content item can be identified directly or through translation of a navigation type. It then shows how this information can be used to create a menu for further navigation.
Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Suggested Courses

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question