Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
A total newbie when it comes to batch scripting. I have absolutely no clue where to start.
I have a .txt file that has a list of servers separated by a carriage return.
I want a simple batch program that will read this .txt file and look for any servers that has the word "serweb" in it.
Once it finds it I want it to write that result list to a new .txt file and call it serweb_list.txt
thank u for any and all help.

For that job one line command just suffices. At prompt type
Type server.txt | Find /I "serweb" > serweb_list.txt
and you are done (almost this time...).

OK...It created the file like I wanted it to but I need to do the following with that file...
Take each of the servers listed in serweb_list.txt and then copy a log file that gets created on each server to a central file server.
The location of the log file is C:\logger
and the name of the log file is http.log
and the server it needs to get copied to is \\logcollector\log_share.thanks again for all ur help.

Hmmm... as I supposed the game wasn't over.
To go on however the shared name of C:\logger for each server is needed and better to post a line of serweb_list.txt.
Copy supports UNC naming but obviously they have to be known.

There is no shared name perse and I suppose the way to get the log file is to use \\paftserweb001\c$\logger\http.log
A partial listing of the serweb_list.txt...
paftserweb001
paftserweb022
paftserweb032
paftserweb039
paftserweb053
.
.
.
.

@Echo Off
For /F "tokens=*" %%J in (serweb_list.txt) Do (
Copy \\%%J\c$\logger\http.log \\logcollector\log_share\%%J_http.log)where the Copy command fits just ONE line ending with _http.log).
I prefixed the name of the collected logs with their native origin, otherwise each log overrides the previous one.
Try the script and repost if you face problem. Sorry for the long time lag but I live in Milano - Italy (EU).

![]() |
![]() |
![]() |

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