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?
chdir to list files
Moderator: DosItHelp
Re: chdir to list files
Code: Select all
dir C:\Temp C:\Temp1 C:\Temp3
Re: chdir to list files
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:\>
Re: chdir to list files
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!
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!
Re: chdir to list files
You only need the /P once.