View Full Version : Copying Command line to Text file.
mikehende
08-31-2006, 04:50 PM
Sorry I had to start a new thread for this guys but I did so becuase I had asked this question a short while back and no one here seemed to know the answer, I just found the answer and so I wanted to make sure everyone here saw this thread/post.
The answer is trace.txt, that sends the output to the text file trace. It redirects the output from the screen to the text file, so it doesn't show anything thing other than a blinking cursor while running. Look in your documents and settings or my documents folder for the file trace.txt...it is there.
Cool huh?:)
mikehende
08-31-2006, 04:53 PM
Actually when I do it, it automatically opens up in Notepad and I think it is doing this now after I had opened it in Notepad the first time.
rVidia
08-31-2006, 08:51 PM
Mike, what command are you entering so that trace.txt is automatically created? I cannot find it on my computer.
I generally do something different to send the output of a command to a text file. As an example, here is how I would go about doing so:
Take the command "dir" for example. When you open a Command Prompt, you generally see "C:\Documents and Settings\User" ("User" being the username you are logged onto). To send the output of "dir" to a text file on the desktop, I would enter the following commands:
cd Desktop
dir > output.txt
You can change the name of the text file to anything you desire, and you can save it to a different location (use "cd" to change the location). In the above code, the location would be "C:\Documents and Settings\User\Desktop" and after entering "dir > output.txt" the output of "dir" would be sent to a text file and saved on the desktop.
This is how I send output of commands to text files.I don't understand what trace.txt contains. Could you explain?
Ray
PeteF
09-01-2006, 02:11 AM
.......after entering "dir > output.txt" the output of "dir" would be sent to a text file and saved on the desktop.
This is how I send output of commands to text files.I don't understand what trace.txt contains. Could you explain?
Ray, I think you hit it on the head.
There is nothing built into winXP to that creates trace.txt automatically.
Mike must have been following directions while doing some troubleshooting
and entered a command to create the file.. trace.txt on his computer.
I searched my WinXP computer and found nothing,
I googled "trace.txt" and only found procedures relating to directing
the output of the TRACE command to a text file using the ">" thing
as demonstrated in your quote above.
---pete---
mikehende
09-01-2006, 09:10 AM
Sorry guys, only now saw this post after having to sign off early yesterday evening to run errands with the missus, that's kinda mandatory:D . What I did was run a command for anything, after that comes up on the screen then I simply type trace.txt BUT for some odd reason now it does not work, when I look in my documents I see only the "trace" file and not the trace.txt, I deleted the trace file but still nothing, very strange.
BTW Pete, no, I did not create a trace file or do anything else, when the guy told me to type trace.txt, that is all I did and it worked for the first "few" times, I am waiting for help from him to figure out why it does not work now, will report back here if/when I get an answer.
Ray, well no biggie, yours works just as good, thanks!
rVidia
09-01-2006, 05:35 PM
...the ">" thing...
For informational purposes, ">" is considered one of the types of redirectors, which allow you to specify how the input or output of a command should be displayed/used. Here is a brief description of the different redirectors as best as I can explain them:
> stores the output of a command in a text file
>> appends the output of a command to an existing text file
< takes data from an existing text file and uses it as input for a command
| takes the output of one command and uses it as input for another command
For example, in my previous post, I gave an example of how to use the ">" redirector. To append another output of the "dir" command to the output.txt file created earlier, enter
dir >> output.txt
into the Command Prompt. (Note when working with text files, make sure you are in the location the text file is saved in; use the "cd" command if necessary.)
To use the data in output.txt as input for the "sort" command (to sort/alphabetize the data in output.txt), enter
sort < output.txt
into the Command Prompt.
To use the output of the "dir" command as input for the "sort" command, enter
dir | sort
into the Command Prompt.
You can use multiple redirectors as well. For example, to alphabetize output.txt and send that output to a text file, enter
sort < output.txt > sorted.txt
into the Command Prompt. Notice the two redirectors used. In red, the data in output.txt is being used as input for the "sort" command, and in blue, the output of that command (the alphabetized output.txt) is being stored in the sorted.txt text file.
My examples don't really show the usefulness of these redirectors, but redirectors do come in handy when working in the Command Prompt. More information here (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true).
And on a final note,
Re: TRACE.txt, I am waiting for help from him to figure out why it does not work now, will report back here if/when I get an answer.
Please do!
Ray
compusimple
09-01-2006, 09:08 PM
also can be used to send info directly to prinjter. To print out a directory
dir c:\temp >prn
prn is designation for parrallel port printer.
Elliott
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.