Reputation: 21
I have this batch file code
dir /a:d /s /b | sort
I can't seem to get it to output the information to a text file. I tried this
dir /a:d/s/b/o:n | sort > Folder Listing.txt
but nothing happens. I can get the command prompt to pause on screen by doing
dir /a:d /s /b | sort
pause
Upvotes: 2
Views: 73
Reputation: 10529
If you want your listing to go into a file called Folder Listing.txt
, you need to enclose it in double quotes:
dir /a:d /s /b /o:n | sort > "Folder Listing.txt"
This is valid for most if not all operations on the Windows shell which involve file names containing spaces.
Upvotes: 2