How to Generate Directory Listing with Full Path from Batch

  • Scripting
  • Published Aug 3, 2010 Updated Oct 28, 2010

Sometimes you need a list of all the files and/or folders in a directory with their full path, without any additional information. “DIR /B” would be the right command, if it only printed out the full path (it does that only if combined with the recursion parameter /S).

Here is a way to print a list of full paths, in the following example of all directories in the folder “C:\Users”:

D:\>for /f "delims=" %i in ('dir /b /ad "C:\Users"') do @echo C:\Users\%i
C:\Users\All Users
C:\Users\Default
C:\Users\Public
...

If you want files listed, replace “/ad” with “/a-d”. If you want both files and directories, use “/a”.

Comments

Related Posts

PowerShell Script: Test Chrome, Firefox & IE Browser Performance

PowerShell Script: Test Chrome, Firefox & IE Browser Performance
There is more than one way to test the performance of web browsers like Chrome, Firefox, or IE, but regardless of how you do it, you need a consistent workload that makes the browsers comparable. Unless you are testing with synthetic benchmarks (which come with a plethora of problems of their own) you need a way to automate browsers opening tabs and loading URLs. This article presents a simple solution to do just that.
Scripting

Latest Posts