Can't get script to work using a public key

Advertisement

danp306
Joined:
Posts:
2
Location:
CT

Can't get script to work using a public key

This is our current command which works fine:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /console /script=current_file.cmd
Current_file:
open sftp://bpxxxxxx:yxx=MxxP@sftp-uat-us.aciondemand.com:22/
We are using a public key with our new connection. I can't get it to work via a script file:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /console /script=new_file.cmd
new_file:
open sftp -o IdentityFile="c:\winscp_pk\convertsshuat" bpxxxxxx@sftp-uat-us.aciondemand.com
I get the following error:
"open" is not recognized as an internal or external command
If I take out the open and just try sftp I get:
"sftp" is not recognized as an internal or external command
Is it a problem using a script with a public key?

Any help would be appreciated.

Thanks
Dan

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Can't get script to work using a public key

You have two problems.
  • You are obviously trying to run new_file.cmd directly as if it were a Windows batch file, instead of via winscp.com (contrary to what you claim). Hence the ""open" is not recognized as an internal or external command" error from Windows command interpretter (cmd.exe). So that has nothing to do with any private key.
  • The -o IdentityFile is OpenSSH syntax. It has nothing to do with WinSCP.
    In WinSCP, use -privatekey:
    https://winscp.net/eng/docs/scriptcommand_open#privatekey
    But that will become a problem only after you fix the previous point.

Reply with quote

danp306
Joined:
Posts:
2
Location:
CT

Getting closer...

Hi Martin,

Thanks so much for your help. I'll gladly donate $$ for your help.

I did get to at least get logged into the site, but it's not recognizing the public key.

Please see the attached screenshot. Any ideas?

Thanks again
Dan

WinSCP 2023-06-29_08-54-21.jpg

Reply with quote

Advertisement

You can post new topics in this forum