Computing.Net > Forums > Programming > Help with simple batch scripting

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Help with simple batch scripting

Reply to Message Icon

Name: serenitynow
Date: April 11, 2007 at 12:17:01 Pacific
OS: windows server 2003
CPU/Ram: Opteron, 2 gig
Product: Dell
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: April 11, 2007 at 12:26:07 Pacific
Reply:

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...).


0

Response Number 2
Name: serenitynow
Date: April 11, 2007 at 12:34:05 Pacific
Reply:

Thanks IVO..
Will give it a shot and let u all know.


0

Response Number 3
Name: serenitynow
Date: April 11, 2007 at 15:46:19 Pacific
Reply:

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.


0

Response Number 4
Name: IVO
Date: April 12, 2007 at 03:27:25 Pacific
Reply:

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.


0

Response Number 5
Name: serenitynow
Date: April 12, 2007 at 08:10:21 Pacific
Reply:

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
.
.
.
.


0

Related Posts

See More



Response Number 6
Name: IVO
Date: April 13, 2007 at 02:57:19 Pacific
Reply:

@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).


0

Sponsored Link
Ads by Google
Reply to Message Icon






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: Help with simple batch scripting

Simple Batch Script help www.computing.net/answers/programming/simple-batch-script-help/12744.html

Batch Script Help Needed www.computing.net/answers/programming/batch-script-help-needed/14475.html

Need help with WinXP batch script www.computing.net/answers/programming/need-help-with-winxp-batch-script/13165.html