Command line help

Discussion in 'QnA (read only)' started by hitesh_hg, Aug 5, 2006.

Thread Status:
Not open for further replies.
  1. hitesh_hg

    hitesh_hg New Member

    Joined:
    Oct 28, 2003
    Messages:
    138
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    NCR
    here is what i wanna do and some how all in command prompt..

    1. search for a file (dir filename.ext /s /b)
    this gives output in the form of absolute path including the filename and no other crap e.g. c:\Program Files\wherever\filename.ext

    now i wanna use the path(s) obtained above to view the content...
    any ideas on how to do it??
    i read DOS for dummies a long time back and there was some implementation..

    actually i want to store all the command in a batch file and route the display (type ) to another file, all in the background...

    thanks
    Hitesh Gupta
     
  2. Sykora

    Sykora I see right through you.

    Joined:
    Sep 10, 2005
    Messages:
    597
    Likes Received:
    4
    Trophy Points:
    0
    Location:
    Chennai
    You have to pipe it.

    Code:
    dir filename.ext /s /b | <whatever you want to do with the files>
    
    You send the output of the first operation through the pipe to the second operation.
     
  3. Rollercoaster

    Rollercoaster -The BlacKCoaT Operative-

    Joined:
    Mar 10, 2005
    Messages:
    1,206
    Likes Received:
    17
    Trophy Points:
    0
    Location:
    Dehradun, India
    do u want to view the contents of the filename.ext or the containing directory c:\Program Files\wherever\ ?


    --to save the output of the command use "dir filename.ext /s /b > output.txt"
    this will save all the output into the text file "output.txt"

    you will have to use some kind of loops... try googling "dos loops"
     
    Last edited: Aug 5, 2006
Thread Status:
Not open for further replies.

Share This Page