How to redirect terminal output of winscp3.com to file

Advertisement

TN
Guest

How to redirect terminal output of winscp3.com to file

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?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,658
Location:
Prague, Czechia

Re: How to redirect terminal output of winscp3.com to file

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

_________________
Martin Prikryl

Reply with quote

Kaydet81
Guest

Re: How to redirect terminal output of winscp3.com to file

martin wrote:

You can only redirect whole session:
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:
"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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,658
Location:
Prague, Czechia

Re: How to redirect terminal output of winscp3.com to file

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,658
Location:
Prague, Czechia

You need to run the command via intepreter (cmd.exe) to allow output redirection from "run" dialog.
_________________
Martin Prikryl

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,658
Location:
Prague, Czechia

Re: Logging terminal output

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

Reply with quote

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

Reply with quote

Advertisement

farmerBill
Guest

PS

Sorry I didn't answer your post completely. It creates an empty file. The FTP commands work ok. Same behavior with "CMD.EXE" omitted.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,658
Location:
Prague, Czechia

Omit both start and cmd.exe. This way you are redirecting output of start command, which has none.

Reply with quote

Advertisement

You can post new topics in this forum