• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

printing a directory in XP

JCROCCO

Senior member
I have this script that can print a directory to the printer. Problem is, it is in no particular order.

I put it into Excel, and it worked but didnt put them in individual cells, and the sorting was from the date, so all 01 dates were together, no matter what year!!

Is there a way to change the print command to print it in order either by date or by name?

Here is the file:

@echo off
dir %1 /o:g > c:\directory.txt
start /w notepad /p c:\directory.txt
del c:\directory.txt
exit

Thanks
 
the /o:g in your command tells it to group directories first.

/o: d it will sort by date/time
/o: n by name alphabetically
/o: s by size
/o: e by extension alphabetically

EDIT: I had to add spaces between the : and letter to avoid the darn forum smilies! Remove the space after the : for it to work.
 
Great, thanks.

Is there a way I can add that to the above program so it doesnt read it, just for reference, so I can change it at will.

Like:

# this blocks it out OR
; this blocks it out OR
something else, for comments?

Also, where would I find this info if knowledgable people didnt give it to me?
 
Put REM in front of any line you don't wan't read by the parser (REM - remark)

These are basic dos commands. At a cmd prompt type dir /? to see all the options available for the dir command.

Dos Commands
 
Back
Top