Topic "How to redirect terminal output of winscp3.com to file"

Author Message
TN

Guest


Hello there I got a question, is it possible to redirect the output of winscp3 command shell promt into file? I would like to generate files with the content of my directories. I tried to use ls > list.txt, but it doesn't work win winscp3.com command shell. Can anybody help?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
You can only redirect whole session:
Quote:
winscp.com /command "open user@host" "ls" > output.exe

_________________
Martin Prikryl
Kaydet81

Guest


prikryl wrote:
You can only redirect whole session:
Quote:
winscp.com /command "open user@host" "ls" > output.exe


I am trying to call WinSCP from a Visual C++ 6 program using CreateProcess. The resultant command line is something like:
Quote:
"C:\Program Files\WinSCP3\WinSCP3.com" /script=C:\TEMP\SCR1.tmp > C:\TEMP\SCR2.tmp 2>&1

This works fine from a command prompt but does not work well from my program (with appropriate escapes for "\") or the Windows "Run" dialog. The Run dialog produces the same results as my program - I get a console window that prompts for a user name, shows some errors, and does not redirect output.

For context, my VC6 program's purpose is to get files from source control (PVCS) and push them out to the server with WinSCP in a seamless fashion. I need to capture output to know the nature of errors that may occur.

Thank you.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Kaydet81 wrote:
This works fine from a command prompt but does not work well from my program (with appropriate escapes for "\") or the Windows "Run" dialog. The Run dialog produces the same results as my program - I get a console window that prompts for a user name, shows some errors, and does not redirect output.

I'll try that. I never did.
_________________
Martin Prikryl
xpcommon
[View user's profile]

Joined: 2006-01-19
Posts: 1
i ll see it later
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
You need to run the command via intepreter (cmd.exe) to allow output redirection from "run" dialog.
_________________
Martin Prikryl
farmerBill

Guest


winscp.com /command "..." "..." > out.txt

does not work. Any ideas?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
farmerBill wrote:
winscp.com /command "..." "..." > out.txt

does not work. Any ideas?

And what does it do? Where do you run the command from?
_________________
Martin Prikryl
farmerBill

Guest


(VISTA .bat file):

@echo off
start "cmd.exe /A WinSCP" "C:\Program Files\WinSCP\WinSCP.com" /command ^

"open student@localhost" ^
"cd /home/student/asas" ^
"pwd" ^
"put abc.txt" ^
"ls" ^
> hw3updat.scriptlog
farmerBill

Guest


Sorry I didn't answer your post completely. It creates an empty file. The FTP commands work ok. Same behavior with "CMD.EXE" omitted.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Omit both start and cmd.exe. This way you are redirecting output of start command, which has none.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
See guide to using WinSCP from .NET.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

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