Grumblesaur wrote:Making my eyes hurt with lack of whitespace?FormalMoss wrote: <snip>


If there were whitespaces in there, it wouldn't do what DWMagus correctly surmised (and he wins a lollipop).
Ahh, but I have nicer batch scripts that help when working on computers, and for those, I prefer to use nested for loopsDWMagus wrote: Copying files (listed in dirs.txt) from C:\ up to a server into a folder named after the PC name and generating a report using the logging function and storing it into a txt file in the same directory.
Robocopy FTW.
Of course, if you have a second list of computers, you could abstract this one more level and have it iterate through all of them remotely if you just use the \\%PCNAME%\C$ share.![]()
Then you could also link that bat/cmd file into a scheduled task and make it automatically run.
Code: Select all
for /l %%I IN (2,1,52) handles the 3rd octet
for /l %%I IN (2,1,9) handles the 4th octet
and an if /i "%IP%" equ "%DOESNTEXISTS%" handles the PCs that don't exist on the network :)
find /i ":" report*.txt
into another text file to concatenate all the reports into a single file - then I just look for the results, and as long as they're mostly 0 (ie. no skipped files), I'm happy there is a successful copy... which can then be verified by running my favourite db.cmd (which is run from the directory in question, via CMD prompt).
Code: Select all
@echo off
cls
dir /s/w | find /i "byte"