chdir to list files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
johnpc
Posts: 6
Joined: 24 Sep 2015 03:19

chdir to list files

#1 Post by johnpc » 24 Sep 2015 04:07

I have 3 temp directories temp, temp1, temp3. I would like to create a batch file that displays their contents.
This is what I have written but it doesn't work

@echo off
cd c:\
dir\temp/p
pause

cd c:\
dir\temp1/p
pause

Any ideas?

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: chdir to list files

#2 Post by Squashman » 24 Sep 2015 06:36

Code: Select all

dir C:\Temp C:\Temp1 C:\Temp3

johnpc
Posts: 6
Joined: 24 Sep 2015 03:19

Re: chdir to list files

#3 Post by johnpc » 25 Sep 2015 00:53

Dose not seem to work.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: chdir to list files

#4 Post by Squashman » 25 Sep 2015 06:48

johnpc wrote:Dose not seem to work.

Strange. I must be special then.

Code: Select all

C:\>dir C:\Temp C:\Temp1 C:\Temp3
 Volume in drive C is 13_06P
 Volume Serial Number is 5AE4-90D0

 Directory of C:\Temp

09/25/2015  07:47 AM    <DIR>          .
09/25/2015  07:47 AM    <DIR>          ..
12/10/2013  04:31 PM    <DIR>          convert
01/20/2014  12:41 PM    <DIR>          DBF_Convert
               0 File(s)              0 bytes

 Directory of C:\Temp1

09/25/2015  07:47 AM    <DIR>          .
09/25/2015  07:47 AM    <DIR>          ..
09/25/2015  07:47 AM                 6 File1.txt
               1 File(s)              6 bytes

 Directory of C:\Temp3

09/25/2015  07:47 AM    <DIR>          .
09/25/2015  07:47 AM    <DIR>          ..
09/25/2015  07:47 AM                 6 File3.txt
               1 File(s)              6 bytes
               2 Dir(s)  198,622,048,256 bytes free

C:\>

johnpc
Posts: 6
Joined: 24 Sep 2015 03:19

Re: chdir to list files

#5 Post by johnpc » 25 Sep 2015 15:14

Not as strange or special as me!

Of course it works, I had typed Temp 1, Temp 2 etc. instead of Temp1, Temp2 etc.

Corrected Version:

dir C:\Temp /p C:\Temp1 /p C:\Temp2 /p C:\Temp3 /p
pause

I apologize for misspelling of Does in my previous reply ("Dose not seem to work")

Thank you!

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: chdir to list files

#6 Post by Squashman » 25 Sep 2015 16:16

You only need the /P once.

johnpc
Posts: 6
Joined: 24 Sep 2015 03:19

Re: chdir to list files

#7 Post by johnpc » 27 Sep 2015 05:52

Thanks Again.

Post Reply