1.

Solve : What Switch Prevents Path from showing??

Answer»

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. Do you only want the files in the C:\root folder as you have shown?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


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 %%~nxGDoes 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.



Discussion

No Comment Found