Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Howto make a batch that will read a .txt file as input

Reply
Thread Tools Display Modes

Howto make a batch that will read a .txt file as input

 
 
David Lewis
Guest
Posts: n/a

 
      10-16-2003
I want to use a batch file to copy/install stuff to remote machines.
I want to have a text file with a list of machines to process as input
to the batch. When the batch file runs it processes every machine
in the list.

Or maybe how do I have a batch process every machine in the domain
except servers? That is needed also, as I have two different kinds of
updates to deploy. OS updates to all machines and Software updates to
specific machines.

Last how could I check for OS versions. I might need to process NT
different then Win2000
 
Reply With Quote
 
 
 
 
Richard Moreno
Guest
Posts: n/a

 
      10-17-2003
Here's how we process similar batch files:

we create 2 batch files: one calls the other

in the 1st one, it contains the command variables you want executed.
example: (filename is auto.bat)
rcmd \\%1 net stop spooler

in the 2nd file, it contains the list of servers\machines. example:
(filename is serverlist.bat (or whatever name))
call auto.bat server-name-here
call auto.bat server-name-here

The 2nd file is editable in an excel spreadsheet as needed and then
copy\pasted into this txt file and renamed to bat (or just directly to the
bat file.)

Thanks-
Richard




"David Lewis" <*@*.*> wrote in message
news:...
> I want to use a batch file to copy/install stuff to remote machines.
> I want to have a text file with a list of machines to process as input
> to the batch. When the batch file runs it processes every machine
> in the list.
>
> Or maybe how do I have a batch process every machine in the domain
> except servers? That is needed also, as I have two different kinds of
> updates to deploy. OS updates to all machines and Software updates to
> specific machines.
>
> Last how could I check for OS versions. I might need to process NT
> different then Win2000



 
Reply With Quote
 
 
 
 
Mike
Guest
Posts: n/a

 
      10-20-2003

::~~Script~~.
:: @echo off
::----------------------- batch code -----------------------

::variables
:: sets initial variables

:mainloop
:: Loops through a file for server names
for /F %%I in (c:\temp\server.txt) do Call :begin %%I
goto :EOF

:begin
set srv=%1
:do the deed
: copys a file to the C:\Temp directory on a distant machine
xcopy c:\temp\myfile.exe \\%srv%\c$\temp
:exit

--


-------------------------------------------------------------------------
FIGHT BACK AGAINST SPAM!
Download Spam Inspector, the Award Winning Anti-Spam Filter
http://mail.giantcompany.com


"Richard Moreno" <> wrote in message
news:...
> Here's how we process similar batch files:
>
> we create 2 batch files: one calls the other
>
> in the 1st one, it contains the command variables you want executed.
> example: (filename is auto.bat)
> rcmd \\%1 net stop spooler
>
> in the 2nd file, it contains the list of servers\machines. example:
> (filename is serverlist.bat (or whatever name))
> call auto.bat server-name-here
> call auto.bat server-name-here
>
> The 2nd file is editable in an excel spreadsheet as needed and then
> copy\pasted into this txt file and renamed to bat (or just directly to the
> bat file.)
>
> Thanks-
> Richard
>
>
>
>
> "David Lewis" <*@*.*> wrote in message
> news:...
> > I want to use a batch file to copy/install stuff to remote machines.
> > I want to have a text file with a list of machines to process as input
> > to the batch. When the batch file runs it processes every machine
> > in the list.
> >
> > Or maybe how do I have a batch process every machine in the domain
> > except servers? That is needed also, as I have two different kinds of
> > updates to deploy. OS updates to all machines and Software updates to
> > specific machines.
> >
> > Last how could I check for OS versions. I might need to process NT
> > different then Win2000

>
>



 
Reply With Quote
 
David Lewis
Guest
Posts: n/a

 
      11-04-2003
thankx

"Mike" <>
|>
|>::~~Script~~.
|>:: @echo off
|>::----------------------- batch code -----------------------
|>
|>::variables
|>:: sets initial variables
|>
|>:mainloop
|>:: Loops through a file for server names
|>for /F %%I in (c:\temp\server.txt) do Call :begin %%I
|>goto :EOF
|>
|>:begin
|>set srv=%1
|>:do the deed
|>: copys a file to the C:\Temp directory on a distant machine
|>xcopy c:\temp\myfile.exe \\%srv%\c$\temp
|>:exit

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I invalidate ce input system (e.g. keyboard input , mouse input)? PowerAll Windows Vista Drivers 1 01-23-2006 05:31 PM
HOWTO: Read USB keyboard input from boot driver Omer Windows Vista Drivers 1 05-08-2005 05:24 PM
calling a batch from within a batch without knowing the path AdminKen Scripting 4 09-29-2004 05:39 AM
Re: howto batch update dns records Sharad Naik DNS Server 1 06-16-2004 09:04 AM
Re: howto batch update dns records Roger Abell DNS Server 0 06-15-2004 02:42 PM