Path inclusion in Dir

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
drgt
Posts: 160
Joined: 21 Sep 2010 02:22
Location: Greece

Path inclusion in Dir

#16 Post by drgt » 12 Oct 2011 03:32

Yep, that did the trick.

1. I wonder why you must use the redirection twice. I mean, if you use NO redirection, it all appears on the screen fine. One would think, one redirection would render the screen results into the text file ... :?

2. Another thing I noticed is that if you move some files with explorer let's say, and you run this again soon after, the number of files does NOT update. You have to re-run it to get the right number. Is this because the system did not refresh fast enough?

Thanks a lot.

trebor68
Posts: 146
Joined: 01 Jul 2011 08:47

Re: Path inclusion in Dir

#17 Post by trebor68 » 12 Oct 2011 11:59

See the following commands:

Here you see every command of set and the result of the command set.

Code: Select all

(set num=0) & (for /l %a in (1,1,10) do set /a num+=%a)


Here you see any result of the command set.

Code: Select all

(set num=0) & (for /l %a in (1,1,10) do @set /a num+=%a)


Here will you not see any result of the command set. What you see is only the last result that save in num.

Code: Select all

(set num=0) & (for /l %a in (1,1,10) do @set /a num+=%a >nul) & (echo %num%)

The result of the command set will not display at the screen with the ">nul".
The result is going to the NULL device (nowhere).

Post Reply