Don’t forget to say ‘bye’: Running psftp as a Windows Server 2008 Scheduled Task


A user presented the problem in the following way: “I’ve set up a scheduled task for psftp on a Windows 2008 server. The script works fine when I run it manually but when the task runs it just hangs in a status of “running” and never finishes.”

The command was formatted as: psftp username@host -pw [password] -b file.dat

The file.dat contains the commands the user wanted ran in the session.


If you ever try to run a command from the Run window you notice that a command window pops up and quickly shuts down. But a scheduled task doesn’t execute a command in the same manner, instead the task is encapsulating the command and if the command doesn’t exit itself then the task will just remain running. Missing from the .dat file after a couple of lines of mput commands was ‘bye’. Adding ‘bye’ to the end of the file resolved the issue.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s