Computing.Net > Forums > Programming > Batch File Directory Listing

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Batch File Directory Listing

Reply to Message Icon

Name: WhSox21
Date: June 28, 2005 at 07:39:49 Pacific
OS: Win XP Pro
CPU/Ram: 512
Comment:

I'm having one major pain with this batch File.

Here's the code:
@echo off
set CurrentPath="C:\current\"
set BackUps="C:\BackUps\"
CD %BackUps%
for /f %%R in ("dir/s/b/ad %BackUps%") do call :1 %%R
goto :eof

:1
%1
echo %1>Done.txt
pause


Rather than placing the name of the directory in Done.txt it places this: dir/s/b/ad

I have no idea how to fix this. Anyone help me with this problem?

I've been working on this for hours.



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: June 28, 2005 at 14:11:57 Pacific
Reply:

@echo off
set CurrentPath="C:\current\"
set BackUps="C:\BackUps\"
CD %BackUps%
rem Empty Done.txt
type null > Done.txt
rem Don't need %Backup% because you're already changed to it.
for /f %%R in ('dir /s /b /ad') do call :1 %%R
goto :eof

:1
%1
echo %1>>Done.txt
pause


0

Response Number 2
Name: chrisintx
Date: June 29, 2005 at 10:52:11 Pacific
Reply:

would like some help building a simple batch file collecting information from my computers...ip address, mac address and so on and then writing findings to a txt file


0

Response Number 3
Name: dtech10
Date: June 30, 2005 at 12:04:42 Pacific
Reply:

Hi Chrisintx
Not quite sure what data you want, but will this help..

ipconfig /all > data.txt



0

Response Number 4
Name: lachlanmullen
Date: June 30, 2005 at 15:13:52 Pacific
Reply:

dtech10,

When I run that batch it processes ('dir /s /b /ad') sequentially, each time telling me they are invalid commands, and ignoring the single quotes.

any advice?


0

Response Number 5
Name: dtech10
Date: July 1, 2005 at 15:05:59 Pacific
Reply:

Hi
Not quite sure are you using the right quotes.
On my keyboard these are "`" and "'"
Im using the second with is on my "@" key.


0

Related Posts

See More


Reply to Message Icon

vb output access to variables, vb.n...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch File Directory Listing

Batch file to list dir name www.computing.net/answers/programming/batch-file-to-list-dir-name-/17362.html

Batch file to check a directory is www.computing.net/answers/programming/batch-file-to-check-a-directory-is-/17337.html

Batch file to replace a word www.computing.net/answers/programming/batch-file-to-replace-a-word/15770.html