Topic "Issue with using PassPhrase"

Author Message
Swindellvc

Guest


I'm trying to create my first batch script and I'm having issues...that I will deal with one at a time.
My Script looks like this... (I've changed sometimes of security)

@echo off

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="P:\TK20FileInfo\WinSCP.log" /ini=nul ^
/command ^
"open sftp://cofcit:MayKey@huwey.tk20.com/ -hostkey=""ssh-Classified"" -privatekey=""P:\TK20FileInfo\TK20PRI.ppk""-passphrase=""Music"^
"lcd T:" ^
"cd /home/cofcit" ^
"put tk20_StudentTranscriptfile.txt" ^
"put tk20_StudentTestfile.txt" ^
"put tk20_StudentTablefile.txt" ^
"exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)

exit /b %WINSCP_RESULT%

The first issues I had is that the file had prompted for the passphrase..but I saw that I could included it in the open line.
the documentation on the actual syntax didn't include an example so I took a stab at it...it doesn't work.
what is the actual syntax.

The second issue I had. (before I tried to include the passphrase) was after it connected is that the script stopped executing right after "LCD T:"^ and the command window leaves me at a prompt.

any and all help appreciated.


Victor
Swindellvc@cofc.edu
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27059
Location: Prague, Czechia
Both your problems have the same cause.
The syntax of the line with the open command should be:
"open sftp://cofcit:MayKey@huwey.tk20.com/ -hostkey=""ssh-Classified"" -privatekey=""P:\TK20FileInfo\TK20PRI.ppk"" -passphrase=""Music""" ^
(also note the space before -passphrase)
See https://winscp.net/eng/docs/commandline#syntax
Swindellvc

Guest


Thanks...
Advertisements

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License