Topic "Saving the console output to a text file? then hide console"

Author Message
3K
[View user's profile]
Donor
Joined: 2012-01-20
Posts: 34
Location: Geneva
When running a script, a console output appears showing a concise status. How can I save this console output to a text file and hide the console? (I use the /log="logfile.txt" but it's long.)

Thank you. Smile
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
I recommend you use XML logging:
https://winscp.net/eng/docs/logging_xml

If you insist on what you see on the console, you would have to write a wrapping application or script that runs hidden WinSCP, and redirects its output into its own stream.
https://winscp.net/eng/docs/guide_automation_advanced

Or use .NET assembly with its Session.OutputDataReceived event
https://winscp.net/eng/docs/library_session_outputdatareceived
_________________
Martin Prikryl
3K
[View user's profile]
Donor
Joined: 2012-01-20
Posts: 34
Location: Geneva
I've tried the command below where it saved the console output to myconsole.txt. However, when I opened it, there is no line break/return key. Any idea how to insert a line break automatically?

winscp /log="mylogfile.txt" /xmllog="myxmllog.xml" /script="test.txt" >myconsole.txt

Thank you. Smile
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
There are line breaks, but unix style. Some viewer/editors cannot handle that.

Anyway it was fixed already:
https://winscp.net/tracker/show_bug.cgi?id=812
_________________
Martin Prikryl
lochun

Guest


Hi 3K the file myconsole.txt is blank for me when i am trying to concatenate the output in the text file. which version of WINSCP you are using plse?

my code is

"C:\Program Files\WinSCP\winscp.exe" /console /log="mylogfile.txt" /xmllog="myxmllog.xml" /script="test.txt" >myconsole.txt

Thank you in Advance.




3K wrote:
I've tried the command below where it saved the console output to myconsole.txt. However, when I opened it, there is no line break/return key. Any idea how to insert a line break automatically?

winscp /log="mylogfile.txt" /xmllog="myxmllog.xml" /script="test.txt" >myconsole.txt

Thank you. Smile
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
You need to use winscp.com:
https://winscp.net/eng/docs/executables
_________________
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