Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: A question about writing to text files.  (Read 2821 times)

0 Members and 1 Guest are viewing this topic.

andy10614

  • Guest
A question about writing to text files.
« on: April 02, 2010, 01:25:36 PM »
Ok, just to let you know I am not the most experienced person with the command prompt so I do not know a lot about all the different commands however I have an irc bot written in msl, which is a scripting language for mirc. This means that I am not actually the one needing the data, it's the irc bot, so what I am wondering is...

If there is a way you can get all the output of the command prompt to be written to a text file so that i can make the bot read what it returns.

I am using the command prompt for is sending files to a ftp server, so the reason I need this is so that I can view any errors that are returned, and if the transfer is successful or not.

If you have an idea how this is possible, any help would be greatly appreciated.

So to conclude what I need is:
A way of getting all the output from the command prompt into a text file. (by output, i mean everything that it returns to you)
for example:

Code: [Select]
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Andrew>ftp
ftp> open ***
Connected to ***.
220---------- Welcome to *** [privsep] [TLS] ----------
220-You are user number 3 of 50 allowed.
220-Local time is now 19:00. Server port: **.
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.

etc.

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: A question about writing to text files.
« Reply #1 on: April 02, 2010, 09:50:11 PM »
You will need to make a script file containing all your FTP commands. If FTP is interactive, any prompts will be sent to the output file making it difficult for the user to see them. ;D

Code: [Select]
ftp -s:ftp.scr > ftp.console 2>1

ftp.scr is the name of the script file
ftp.console is the name of output log
2>1 re-routes the error messages (STDERR) back to STDOUT for inclusion in the output log

Good luck.  8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein