login about faq

Hi All:

I am getting an error while running through the batch file through command line-- using Tectia SFTP Client -->

command line -->

C:\Temp>sftpg3 -B- C:\Temp\PROFILE.bat
sftp> --> cursor stucks here .. 

-- Batch File start -- PROFILE.bat --- 
sftpg3 PROFILE
cd /incoming/
lcd c:\Temp\
put test.txt
-- Batch File end -- PROFILE.bat ---

Can you please advice what i need to do in-order to get this running...

Thanks in advance.



asked Aug 24 '10 at 10:50

Jaideep's gravatar image


edited Aug 25 '10 at 13:10

Roman's gravatar image

Roman ♦♦

Hi Jaideep,

When using a batch file with the sftpg3 client, the batch file should contain only sftp commands. In your example you're trying to execute sftpg3 within the batch file and this fails since this is not a valid sftp command. You'll need to specify the destination hostname or profile on the command prompt rather than in the batch file itself. Such as:

C:\Temp>sftpg3 -B C:\Temp\batch.txt PROFILE

And batch.txt could contain something like this:

-- Batch File start -- batch.txt --- 
cd /incoming/
lcd c:\Temp\
put test.txt
-- Batch File end -- batch.txt ---

Also note that when using batch mode you'll need to have the hostkey saved and setup some form of non-interactive authentication so that your script doesn't fail when receiving a prompt for password or to save the server's hostkey.

See here for more info on the allowed commands: http://productdocs.ssh.com/support/documentation/online/ssh/winhelp/61/sftpg3.html


answered Aug 25 '10 at 13:15

Roman's gravatar image

Roman ♦♦

Thanks Roman, this has resolved 70% of my issues.

Can we add parameters filepath filename to this command..??

Thanks again.

(Sep 01 '10 at 06:29) Jaideep Jaideep's gravatar image

If you mean can you pass arguments to the script, then no, I don't believe this is supported. It only accepts the same list of commands that you can type interactively when using sftpg3. If you'd like to use parameters you could look into using "-B -" in order to read from standard input instead of from a file or then use scpg3.

(Sep 01 '10 at 12:02) Roman ♦♦ Roman's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Aug 24 '10 at 10:50

Seen: 10,659 times

Last updated: Dec 15 '10 at 17:22

All user contributed content licensed under the cc-by-sa license.
Powered by OSQA.