REM
is the bat file indicator for REMark. (You can use it in VBA, too, but most
people comment lines with an apostrophe).
And my memory isn't very good. So instead of searching for the link in one of
my notes files, I put a comment in the .bat file where the technique came from.
If I screw something up, I can find the original source easier.
This isn't a bad idea for any code that you found via a google search. It may
help you or the person borrowing, er, reviewing the code later.
If you shell to DOS:
Windows start button|Run
type
cmd
and hit enter
You can use:
dir /?
to see all the options that you can use with these old DOS commands.
In WinXP Home, I saw this:
C:\>dir /?
Displays a list of files and subdirectories in a directory.
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
[drive:][path][filename]
Specifies drive, directory, and/or files to list.
/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/B Uses bare format (no heading information or summary).
/C Display the thousand separator in file sizes. This is the
default. Use /-C to disable display of separator.
/D Same as wide but files are list sorted by column.
/L Uses lowercase.
/N New long list format where filenames are on the far right.
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date/time (oldest first)
G Group directories first - Prefix to reverse order
/P Pauses after each screenful of information.
/Q Display the owner of the file.
/S Displays files in specified directory and all subdirectories.
/T Controls which time field displayed or used for sorting
timefield C Creation
A Last Access
W Last Written
/W Uses wide list format.
/X This displays the short names generated for non-8dot3 file
names. The format is that of /N with the short name inserted
before the long name. If no short name is present, blanks are
displayed in its place.
/4 Displays four-digit years
Switches may be preset in the DIRCMD environment variable. Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.
=========
So...
The first line:
@echo off
stops you from seeing the commands as the bat file executes. Much like
application.screenupdating = false in VBA.
The next line.
dir %1 /-p /b /o:gn /s > "%temp%\Listing.txt"
%1 is the folder that you rightclicked on.
/-p says not to pause when the screen is filled up
/b says no header and no summary
/o:gn says order it by directory, then name
/s says include subfolders
is the redirection symbol.
In this case, the output is being redirected to your windows temp folder to a
file named listing.txt.
The next line just starts up notepad so that you can see the output.
start notepad "%temp%\Listing.txt"
The last line:
exit
just closes the cmd window.
You could do this all from the cmd prompt if you wanted, but using the
rightclick|sendto makes it soooo much easier.
Personally, I think being able to do it without using excel is an added benefit.
Oh mannnnnnnnnnnnnn!!!!!!! That was awsom!!!
It worked like a charm. I've made a .bat once, but how does this one work?
What is
REM
http://support.microsoft.com/default.aspx?scid=KB;EN-US;q272623& about?
Thanks