CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Aug 2008
    Posts
    373

    Read Dos Out put

    Hi All

    Can i read Dos command out values in file or Buffer?

    For example if i run dir command in dos then it show file and directory name.Now i want to store these file and directory in file or Buffer.
    is it possible then guide me..

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: Read Dos Out put

    1. I gave some links that could help in your previous thread about running .bat (.cmd) files.

    2. To get the result of "dir command" you don't need starting ms dos dir. There are Windows APIs (FindFirstFile/FindNextFile/FindClose) and their MFC wrapper (CFileFind class) that you should use.
    Victor Nijegorodov

  3. #3
    Join Date
    Aug 2008
    Posts
    373

    Re: Read Dos Out put

    Thanks for reply

    Yes your link help me to solve last problem.

    sir dir command just a example, command may be Copy con,Makedir etc
    Sir is it possible to read values from command prompt?

    Please guide me

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: Read Dos Out put

    MS Dos copy and mkdir have corresponding Win32 "analogs": CopyFile and CreateDirectory.
    Victor Nijegorodov

  5. #5
    Join Date
    Aug 2008
    Posts
    373

    Re: Read Dos Out put

    Quote Originally Posted by VictorN View Post
    MS Dos copy and mkdir have corresponding Win32 "analogs": CopyFile and CreateDirectory.
    Sir i know these thing also Win32 "analogs but my question is
    Is it possible or not?

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: Read Dos Out put

    Quote Originally Posted by Msm View Post
    Is it possible or not?
    Yes, it is possible. See the p.1 in the post#2.
    Victor Nijegorodov

  7. #7
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: Read Dos Out put

    What will you read by dos command copy or delete ?

  8. #8
    Join Date
    Aug 2008
    Posts
    373

    Re: Read Dos Out put

    Quote Originally Posted by VictorN View Post
    Yes, it is possible. See the p.1 in the post#2.
    Sir can you give me more details.

  9. #9
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: Read Dos Out put

    Quote Originally Posted by hypheni View Post
    What will you read by dos command copy or delete ?
    Sorry, I haven't understood what you meant!
    if "what Win32 APIs could be used for copy and delete" then:
    CopyFile
    DeleteFile
    Victor Nijegorodov

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: Read Dos Out put

    Quote Originally Posted by Msm View Post
    Sir can you give me more details.
    Again: I gave some links that could help in your previous thread about running .bat (.cmd) filesPlease, open your previous thread, search for my post with the links, open these links and read (they all are MSDN and Support articles)
    Victor Nijegorodov

  11. #11
    Join Date
    Aug 2008
    Posts
    373

    Re: Read Dos Out put

    Quote Originally Posted by VictorN View Post
    Sorry, I haven't understood what you meant!
    if "what Win32 APIs could be used for copy and delete" then:
    CopyFile
    DeleteFile
    ok sorry
    But this is not solution and not and of my problem..

  12. #12
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: Read Dos Out put

    No, Msm posted Can i read Dos command out values in file or Buffer?

    So what will he store in file or buffer by copy or delete command ?.

  13. #13
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: Read Dos Out put

    Quote Originally Posted by hypheni View Post
    No, Msm posted Can i read Dos command out values in file or Buffer?
    See the post#2 in this thread.

    Quote Originally Posted by hypheni View Post
    So what will he store in file or buffer by copy or delete command ?.
    And what kind of information is supposed to be stored "in file or buffer by copy or delete command"?
    And what for?
    Victor Nijegorodov

  14. #14
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: Read Dos Out put

    Oh yes I didn't check that he asked for values to be read from console. I though he asked for output screen to be saved in file stream.

  15. #15
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Read Dos Out put

    You can of course redirect the output of any console command to a file which can then be read. However, I'm unclear as to why one would do such a thing. Perhaps if you clarified your high-level objective rather than focusing on your present strategy?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured