barrystone Posted March 17, 2011 Posted March 17, 2011 Hi everyone Ive written a small batch file that connects to remote computers, lists the folders in Docments and Settings folder and outputs the results to a text file. The problem is that only results from the last remote computer in the file is output to the text file. I want to have all the computers reults written to the text file. Batch file is as follows:- for /f %%i in (c:\computers.txt) do dir /ad "\\%%i\c$\Documents and Settings" > results.txt I think i need a for next loop Any help and guidance would be appreciated Regards Barry Stone
andy_b Posted March 17, 2011 Posted March 17, 2011 (edited) Not sure if its exactly what you wanted, but using >> will append to the file. e.g for /f %%i in (c:\computers.txt) do dir /ad "\\%%i\c$\Documents and Settings" >> results.txt Alternatively if you want a file for each computer, perhaps this? for /f %%i in (c:\computers.txt) do dir /ad "\\%%i\c$\Documents and Settings" > "results %%i.txt" Edited March 17, 2011 by andy_b 1
barrystone Posted March 17, 2011 Author Posted March 17, 2011 Thanks Thats fixed it Now working a treat Regards Barry Stone
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now