kumarkumar Posted December 29, 2010 Posted December 29, 2010 I have some help commands pertaining to some program which I wish to save in a txt file. Unfortunately all it gives is a blank file.I have used the normal command "command help > somefile.txt". As I understand, using the ">" operator, the output is not dumped to the command prompt window but to the text file. But in this case running this command the output is dumped to the command prompt window as well giving a blank text file.It works with regular DOS commands like "dir > somefile.txt" but not with the specific command that I have.I also tried with clip.exe. Same problem with this too.I could do it with mark & paste but that's not what I am looking for.
Guest Posted December 29, 2010 Posted December 29, 2010 (edited) Assuming "help" is a text file as described above, try the following in a CMD window:TYPE help >somefile.txt Edited December 29, 2010 by 5eraph
jaclaz Posted December 29, 2010 Posted December 29, 2010 (edited) I have some help commands pertaining to some program which I wish to save in a txt file. Unfortunately all it gives is a blank file.I have used the normal command "command help > somefile.txt". As I understand, using the ">" operator, the output is not dumped to the command prompt window but to the text file. But in this case running this command the output is dumped to the command prompt window as well giving a blank text file.It works with regular DOS commands like "dir > somefile.txt" but not with the specific command that I have.I also tried with clip.exe. Same problem with this too.I could do it with mark & paste but that's not what I am looking for.The redirection can be from BOTH "standard output" and from "standard error" see here:http://www.robvanderwoude.com/redirection.phpSome programs may send the output of the "help" parameter to the "standard error".You have no way to know as they appear in the console exactly as "standard output" does.Try:command help > somefile.txt 2>&1Next time, please avoid "vague" descriptions, like "some help commands", "pertaining to some program", and the like,. STATE the EXACT program and the EXACT command and parameter you attempted issuing, as it is more likely that you won't be misunderstood and possibly have a more "targeted" reply.jaclaz Edited December 29, 2010 by jaclaz
Tripredacus Posted December 29, 2010 Posted December 29, 2010 I have used this operator without error before. Make sure you are specifying a path for the file. Just specifying the file name itself means Windows will save it somewhere. Do you know where that place is? Are you not sure the file you are looking at is in-fact the one that was just written?
kumarkumar Posted December 30, 2010 Author Posted December 30, 2010 The redirection can be from BOTH "standard output" and from "standard error" see here:http://www.robvanderwoude.com/redirection.phpSome programs may send the output of the "help" parameter to the "standard error".You have no way to know as they appear in the console exactly as "standard output" does.Try:command help > somefile.txt 2>&1Thanks a lot jalaz. That worked like a charm. It turns out it was from "standard error", hence command 2> file worked too.Next time, please avoid "vague" descriptions, like "some help commands", "pertaining to some program", and the like,. STATE the EXACT program and the EXACT command and parameter you attempted issuing, as it is more likely that you won't be misunderstood and possibly have a more "targeted" reply.jaclazWith due respect......My "vague" descriptions of commands & programs were intentional. The program I am talking about is "devtest", and the command was "devtest help > devtest_help.txt". I wanted the output of "devtest help" to a text file. Since the outside world is mostly unaware of the program how would it have made any difference to the readers if I had mentioned anything in place of "devtest". Since regular DOS commands are mostly known to everyone hence in this case I did mention the exact command "dir > somefile.txt" so that others may get what I am trying to convey.Let me know if in this case mentioning the exact program and exact command would have helped in any way. If so I will take care henceforth to mention the exact program/commands.
jaclaz Posted December 30, 2010 Posted December 30, 2010 (edited) With due respect......My "vague" descriptions of commands & programs were intentional. The program I am talking about is "devtest", and the command was "devtest help > devtest_help.txt". I wanted the output of "devtest help" to a text file. Since the outside world is mostly unaware of the program how would it have made any difference to the readers if I had mentioned anything in place of "devtest". Since regular DOS commands are mostly known to everyone hence in this case I did mention the exact command "dir > somefile.txt" so that others may get what I am trying to convey.Let me know if in this case mentioning the exact program and exact command would have helped in any way. If so I will take care henceforth to mention the exact program/commands.Well, clearly 5eraph - usually attentive and knowledgeable - did misunderstand you, and I had the same problem initially.Most "normal" command line programs do output the result of command to "standard output" and not to "standard error" AND normally use a parameter with a prepended slash or dash, it was NOT immediate to understand the question.On the other hand for all we knew, it could have been another kind of command, as an example you can take DISKPART or WMIC, that do behave "differently" from standard commands (and use not the slash or dash for parameters).Giving the exact reference - and when available - a link to the homesite of the program besides would have made your problem (and hopefully it's answer) findable by other members (or "passers-by") having your same problem.I mean, if you have a problem with, say, devtest, do you google for "devtest help" or for "some program some help commands"? This is one of the advantages of a board (as opposed to PM's or e-mail or phone help/support) problems (and hopefully solutions) are public and may be of use to a lot more people than OP. jaclaz Edited December 30, 2010 by jaclaz
kumarkumar Posted December 31, 2010 Author Posted December 31, 2010 I mean, if you have a problem with, say, devtest, do you google for "devtest help" or for "some program some help commands"? Got the message.Most "normal" command line programs do output the result of command to "standard output" and not to "standard error" AND normally use a parameter with a prepended slash or dash, it was NOT immediate to understand the question.On the other hand for all we knew, it could have been another kind of command, as an example you can take DISKPART or WMIC, that do behave "differently" from standard commands (and use not the slash or dash for parameters).As per the official help of "devtest", help is invoked on using "devtest help". However I found all the commands below to invoke help."devtest help" "devtest -help" "devtest -h" All of them redirect to "standard error".
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now