tag:blogger.com,1999:blog-1028236585843827010.post6354347477719360883..comments2023-06-12T09:59:05.165-04:00Comments on Technical Ramblings: Redirecting DOS stdout stderrShaunehttp://www.blogger.com/profile/14678096394667258061noreply@blogger.comBlogger27125tag:blogger.com,1999:blog-1028236585843827010.post-32252837915963540122012-01-10T09:13:04.865-05:002012-01-10T09:13:04.865-05:00I am very glad to hear people still find this usef...I am very glad to hear people still find this useful :-)Shaunehttps://www.blogger.com/profile/14678096394667258061noreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-54264064131206312702012-01-09T17:34:25.397-05:002012-01-09T17:34:25.397-05:00... and it's STILL of use!... and it's STILL of use!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-14005321255197766302011-05-25T11:25:43.602-04:002011-05-25T11:25:43.602-04:00Most Welcome! I am glad to see this is still of u...Most Welcome! I am glad to see this is still of use to peopleShaunehttps://www.blogger.com/profile/14678096394667258061noreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-81283089084435508712011-05-25T11:11:13.466-04:002011-05-25T11:11:13.466-04:00Thanks for posting. Your site comes up on top of ...Thanks for posting. Your site comes up on top of a google Search for "stderr redirect dos" - not Micro$oft :-)<br /><br />Many thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-50288540863839429302011-04-15T16:11:10.666-04:002011-04-15T16:11:10.666-04:00Thanks for posting this in a way that can actually...Thanks for posting this in a way that can actually be easily found via google!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-49288792215495425162011-04-12T16:06:37.235-04:002011-04-12T16:06:37.235-04:00Thanks! Reference was accurate and easy to find w...Thanks! Reference was accurate and easy to find with Google.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-14438573117592695122011-03-23T13:19:26.202-04:002011-03-23T13:19:26.202-04:00I'd go this route 'Anonymous':
for /f...I'd go this route 'Anonymous':<br /><br />for /f "tokens=2 delims= " %%a in ('psgetsid S-1-5-32-544 2^>nul ^| findstr /r "Alias:"') do set Admins=%%aAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-70152604019010483912010-11-03T10:58:15.545-04:002010-11-03T10:58:15.545-04:00PsGetSid S-1-5-32-544 2>NUL | findstr /R "...PsGetSid S-1-5-32-544 2>NUL | findstr /R "Alias:" 3<sid.txt<br />set /p Admins=0<sid.txt<br /><br />... and cut in desired form<br /><br />puts the admins name to a variable.<br /><br />-- Is there any possibility to pipe the output of FINDSTR to the input of the SET command without using a data file? e.g. through one of the pipes like &5.<br /><br />Tried it but it did not work.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-25876269111495517712010-02-02T07:53:20.413-05:002010-02-02T07:53:20.413-05:00Thank's³ :
1) to take time to answer to me, as...Thank's³ :<br />1) to take time to answer to me, as wird I can be when I did not think wide @all; and even if it took me nearly one year to see I've get a 3h's back answer :} <br />In fact I try to make out a kind of stack by handling handles ...<br />If I may :<br />more XXXX 1>&3 | del XXXX /f /q | more 0<&3 >XXXX<br /><br />2) Oh I forgotten but nothing too important, this is by that blog entry that I've evolved at my level (so far not an exemple, but), so thank's to the will to your need, if I may so.<br /><br />3) Since I'm bad @ langage, thank's you for your efforts.p³https://www.blogger.com/profile/01772233429267321584noreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-7581452565016132972010-02-02T07:52:05.500-05:002010-02-02T07:52:05.500-05:00Thank's³ :
1) to take time to answer to me, as...Thank's³ :<br />1) to take time to answer to me, as wird I can be when I did not think wide @all; and even if it took me nearly one year to see I've get a 3h's back answer :} <br />In fact I try to make out a kind of stack by handling handles ...<br />If I may :<br />more XXXX 1>&3 | del XXXX /f /q | more 0<&3 >XXXX<br /><br />2) Oh I forgotten but nothing too important, this is by that blog entry that I've evolved at my level (so far not an exemple, but), so thank's to the will to your need, if I may so.<br /><br />3) Since I'm bad @ langage, thank's you for your efforts.p³https://www.blogger.com/profile/01772233429267321584noreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-6284971475194794022009-12-31T19:54:45.859-05:002009-12-31T19:54:45.859-05:00Wow! what an idea ! What a concept ! Beautiful .. ...Wow! what an idea ! What a concept ! Beautiful .. Amazing … <br /><br />rH3uYcBXAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-76299412701565069072009-09-23T10:23:20.897-04:002009-09-23T10:23:20.897-04:00Thanks a lot for your post. Microsoft's post i...Thanks a lot for your post. Microsoft's post is not as easy to find as this one and really helped me in my project.<br /><br />Now my question: I want to redirect output both to the console and a file.<br />I've tried <b>'dir > con > file.txt'</b> and variations but just couldn't find the proper combination.<br /><br />Does anyone have an idea?<br /><br />Thanks!Nico D.https://www.blogger.com/profile/12762028089341676216noreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-8482727324275247622009-07-28T22:22:29.513-04:002009-07-28T22:22:29.513-04:00Is there a way to redirect a dos command (regedit)...Is there a way to redirect a dos command (regedit) which requires a file as output to redirect the output to stdout instead? I.e. trick it to write to the screen or clipboard and not to a file at all. I do not wish to create and delete a file to extract some basic reg data.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-31326442321476387072009-05-13T09:43:00.000-04:002009-05-13T09:43:00.000-04:00Hi,
Thanks for this post. I needed to know how to...Hi,<br /><br />Thanks for this post. I needed to know how to redirect standard error into a file. <br /><br />Thanks!<br /><br />Dev.Devarishihttps://www.blogger.com/profile/15116905814965346792noreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-7434182120960771872009-04-02T10:36:00.000-04:002009-04-02T10:36:00.000-04:00No I haven't, I actually do very little command l...No I haven't, I actually do very little command line programming. The only 2 I have every had to deal with is STDOUT and STDERRShaunehttps://www.blogger.com/profile/14678096394667258061noreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-57856849795633686992009-04-02T07:46:00.000-04:002009-04-02T07:46:00.000-04:00Do you have ever try to change where stands 'stdou...Do you have ever try to change where stands 'stdout' or 'stderr' stands,in da code by one of Seven others output-flowZ ? (i.e. by '3', '4', '5', '6', '7', '8', '9' ) ... ⌂pnamehttps://www.blogger.com/profile/17428092874147193674noreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-67589342957524115022009-04-02T07:35:00.000-04:002009-04-02T07:35:00.000-04:00This comment has been removed by the author.pnamehttps://www.blogger.com/profile/06587214959324789947noreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-18586493924425392572009-03-25T05:04:00.000-04:002009-03-25T05:04:00.000-04:00Hi, do you also know how i can redirect stdout and...Hi, do you also know how i can redirect stdout and stderr to a HANDLE in my code (what you were talking about was from command-line). What i wish yo do is catch all stdout and stderr in my C++ code and keep them in a string that would be used in the end of my program...<BR/>thanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-56216553455376291172009-03-09T12:23:00.000-04:002009-03-09T12:23:00.000-04:00no problem. Yes they can be but I also would be wi...no problem. Yes they can be but I also would be with out a job if it wasn't for them :)Shaunehttps://www.blogger.com/profile/14678096394667258061noreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-29051946479890819402009-03-09T04:53:00.000-04:002009-03-09T04:53:00.000-04:00Shaune, I appreciate your tries and reply though n...Shaune, <BR/><BR/>I appreciate your tries and reply though no luck - It's MS evil.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-25115285646274851722009-02-27T10:06:00.000-05:002009-02-27T10:06:00.000-05:00Well Anonymous, all I can say is it must be using ...Well Anonymous, all I can say is it must be using some special handle to output. I did try redirecting the other handles <BR/><B>"telnet mysvr 500 >log.txt 4>&1"<BR><BR/>"telnet mysvr 500 >log.txt 5>&1"</B><BR><BR/>with no luck.Shaunehttps://www.blogger.com/profile/14678096394667258061noreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-30412628522925161362009-02-27T01:59:00.000-05:002009-02-27T01:59:00.000-05:00I am more concerned of the re-directing case using...I am more concerned of the re-directing case using "2>&1", however, this doesn't work for me with DOS/telnet commmand.<BR/><BR/>Specifically, say, use following command ("mysvr" is a server name, 500 is TCP port#), and assume this port is not opened, hence you should see a msg "Connecting to mysvr... Could not open..."<BR/><BR/>DOS> telnet mysvr 500<BR/>Connecting to mysvr... Could not open..<BR/><BR/>The thing is this warning msg never goes to a log file even if trying follow:<BR/><BR/>DOS> telnet mysvr 500 >log.txt 2>&1<BR/><BR/>The log.txt is created but having a 0 size.<BR/><BR/>Can anybody shed more light? Really appreciate.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-86549964965442668942009-01-31T18:25:00.000-05:002009-01-31T18:25:00.000-05:00Could just be me, but 1<&2 seems to put STD...Could just be me, but 1<&2 seems to put STDOUT to STDERR.<BR/><BR/>2<&1 did what I actually wanted, redirect STDERR to STDOUT.<BR/><BR/>Maybe I misread that paragraph above...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-58053248773539367442009-01-22T08:54:00.000-05:002009-01-22T08:54:00.000-05:00:):)Shaunehttps://www.blogger.com/profile/14678096394667258061noreply@blogger.comtag:blogger.com,1999:blog-1028236585843827010.post-13348701662516399532009-01-22T02:22:00.000-05:002009-01-22T02:22:00.000-05:00Go somewhere else this site is not for you! I am g...Go somewhere else this site is not for you! I am grateful I found this blog. Thanks Shaune, I think he read only the first paragraph.Anonymousnoreply@blogger.com