DOS File Listing Program

G

Guest

I am working with a batch file that was offered as a solution on a few
websites for the problem of getting a editable list of files within a
directory. The problem I am having is no matter which folder I select, I
keep getting a list of files in C:\Windows (the listing does appear in the
folder selected). Here is the program --

cd %1
dir /a /b /-p /o:GEN >"C:\Documents and Settings\All Users\Temp\filelist.txt"
copy "C:\Documents and Settings\All Users\Temp\filelist.txt" %1
del "C:\Documents and Settings\All Users\Temp\filelist.txt"

The batch file is in the windows directory.

If anyone can help me get this working right, that would be great!

Thanks!
 
T

Tom Porterfield

Eric said:
I am working with a batch file that was offered as a solution on a few
websites for the problem of getting a editable list of files within a
directory. The problem I am having is no matter which folder I select, I
keep getting a list of files in C:\Windows (the listing does appear in the
folder selected). Here is the program --

cd %1
dir /a /b /-p /o:GEN >"C:\Documents and Settings\All
Users\Temp\filelist.txt" copy "C:\Documents and Settings\All
Users\Temp\filelist.txt" %1
del "C:\Documents and Settings\All Users\Temp\filelist.txt"

The batch file is in the windows directory.

If anyone can help me get this working right, that would be great!

Are you possibly trying to run this for folders on drives other than C:? If
so, change the first line of the batch program to as follows:

cd /D %1

I would also change it to use the temp environment variable rather than
hard-coded pathes that may not exist. So here would be my implementation:

cd /D %1
dir /a /b /-p /o:GEN >"%TEMP%\filelist.txt"
copy "%TEMP%\filelist.txt" %1
del "%TEMP%\filelist.txt"

You could also optionally bypass the temp directory altogether by making the
file as follows:

cd /D %1
dir /a /b /-p /o:GEN >"%1\filelist.txt"
 
G

Guest

If you're launching the batchfile from a shortcut, then it's simply a
question changing the "Start In Folder..." property of the shortcut.
 
G

Guest

This worked great and solved my problem with getting the list of the desired
directory. However, I still can't get a list froma network drive -- any
ideas?

Thanks!
 
T

Tom Porterfield

Eric said:
This worked great and solved my problem with getting the list of the
desired directory. However, I still can't get a list froma network drive
-- any ideas?

Are you passing in the UNC name? If so, that won't work with CD as you
can't change to a network drive via UNC. That being said, you should be
able to remove the CD altogether and it still work. Try the following:

dir %1 /a /b /-p /o:GEN >%1\filelist.txt

There you go, down to one line and should work the same for C drive, D drive
or network UNC.
 
G

Guest

Yeah -- the explorer would be passing the name as \\server\users\....

Removing cd didn't help. Hmmmmmm....I'll have to think harder unles you
have another suggestion??

Eric
 
T

Tom Porterfield

Eric said:
Yeah -- the explorer would be passing the name as \\server\users\....

Removing cd didn't help. Hmmmmmm....I'll have to think harder unles you
have another suggestion??

Did you remove the CD and change the remaining line to the above? It should
work, though for testing I'm running from a command prompt rather than any
explorer integration.
 
G

Guest

I did remove the "cd" line and yes I am running it from an explorer
integration -- It is added as a menu option when right clicking on a folder.

*sigh* still can't think of how to work around this!!

Eric
 
T

Tom Porterfield

Eric said:
I did remove the "cd" line and yes I am running it from an explorer
integration -- It is added as a menu option when right clicking on a
folder.

*sigh* still can't think of how to work around this!!

If you'll send the registry settings that show how you have the explorer
integration setup, I'll see what I can figure outs.
 
T

Tom Porterfield

Eric said:
Here is the website I took it from --

http://www.theeldergeek.com/file_list_generator.htm

It shows up as an entry in the registry under... My
COmputer\HKEY_CLASSES_ROOT\Folder\shell as the default entry.

All I can say is it works fine for me based on my last modification that I
reported. At this point my batch file is nothing more than the following
single line:

dir %1 /a /b /-p /o:GEN >%1\filelist.txt

I see the mod that you were going for, to not have the filelist.txt file
show up in the list. Here is the content of the batch file that will make
it work that way:

dir %1 /a /b /-p /o:GEN >%TEMP%\filelist.txt
move %TEMP%\filelist.txt %1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top