Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: What Switch Prevents Path from showing?  (Read 3332 times)

0 Members and 1 Guest are viewing this topic.

matrix

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Windows 7
    What Switch Prevents Path from showing?
    « on: January 24, 2014, 08:14:22 PM »
    Fellow Forum Members,

    Using the MSDOS command below:

    C:\Root>dir /b /s | more

    Produces the list below on my monitor screen:
    C:\Root>file1.doc
    C:\Root>file2.doc
    C:\Root>file3.doc
    C:\Root>file4.doc

    The problem is I don't want the "C:\Root" text to appear. I only want the "file#.doc" text to appear on my monitor screen. What switch do I need to use (besides /b & /s) to prevent the "C:\Root" text from appearing. In short, my goal is to only generate a list that creates a filename list without any path information included.  I then want to select all the text and copy it so I can paste it into Word.   I told my Boss I need an app called SnagIT but he is too cheap to buy it.  Any info will be appreciated.

    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: What Switch Prevents Path from showing?
    « Reply #1 on: January 24, 2014, 09:10:42 PM »
    Do you only want the files in the C:\root folder as you have shown?

    matrix

      Topic Starter


      Newbie

      • Experience: Beginner
      • OS: Windows 7
      Re: What Switch Prevents Path from showing?
      « Reply #2 on: January 25, 2014, 05:06:23 PM »
      Foxidrive,
      Thanks for your post.  The end result I want to see on my screen is shown below:

      file1.doc
      file2.doc
      file3.doc
      file4.doc

      I want to prevent any path related text from showing. What switch do I need to use to make this happen?  In addition, I want the results to display on the screen monitor. I don't want a text file generated that contains the text. the "|more" command seems to make this happen. But it would be nice to use a different command that shows the entire results and not on separate screens.  Any help in modifying the command text below will be greatly appreciated. Thanks.

      C:\Root>dir /b /s | more



      Squashman



        Specialist
      • Thanked: 134
      • Experience: Experienced
      • OS: Other
      Re: What Switch Prevents Path from showing?
      « Reply #3 on: January 25, 2014, 05:40:57 PM »
      if you dont need to traverse the sub directories then remove the /s option.

      If you need to traverse sub directories and only want to display the filename then you need to encapsulate your command inside a for  loop.
      Code: [Select]
      for /f "delims=" %%G in ('dir /b /a-d') do echo %%~nxG

      Geek-9pm


        Mastermind
      • Geek After Dark
      • Thanked: 1026
        • Gekk9pm bnlog
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: What Switch Prevents Path from showing?
      « Reply #4 on: January 25, 2014, 05:52:23 PM »
      Does the OP want a lilts of files with no path?
      But he wants to include files from any sub directories.?

      We, he might get a list of files that are not unique.
      Consider: What if he have 7 files named ''foo" in 7  directories somewhere under the current location. The output would be:
      foo
      foo
      foo
      foo
      foo
      foo
      foo
      What would he do with that information? He haws no idea whee they are.