Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
I've searched the forums but what i find isn't quite what i need(Or i don't know how to mod them to work for me).
What i am trying to do is this:
Copy an .exe to all in listpsexec file on all in list
pauses on all in list
pskill all the processes on all the computers in list
del file from all in list.
************
What i have is this:
_________________________
echo off
echo Hellocopy "c:\lil programs\ld\ld.exe" \\Computer\C$
psexec \\Computer -s -d c:\ld.exeping -n 30 127.0.0.1
pskill \\Computer ld.exe | del \\Computer\c$\ld.exe
pause
exit
__________________________
So as you can see, i need to manually change "Computer" to the computer name every time... in four places in the batch. This script does work perfectly on a one time basis. The only problem is, i need to do this on 500+ machines in batches of 20-30 computers at a time.What i'd like to do is be able to enter the 20-30 computer names in a .txt and have the script go through the .txt and run the copies on all in the list, then psexec all, then pause, then kill the process, then delete the file.
If you could please provide some insight into the easiest, most straight forward way to do this, that would be excellent.
Extra internet points if you help me 'learn' how to do this, (providing a breakdown of "This portion does this, that does that" so i will be able to apply this to other projects in the future without the need for outside help.)Thanks!
Nick

Where do I redeem my points? LOL
::=========================
@echo off
setLocal EnableDelayedExpansionfor /f "tokens=* delims= " %%a in (myLIST.txt) do (
echo copy blah "%%a"
echo psexec blah "%%a"
echo and so on
)
=====================================
If at first you don't succeed, you're about average.M2

tokens=*
means 'use the whole line'
delims= [space]
means 'use SPACEs & TABs as separators' in this case, not important. I always use them unless they would gum up the works.
=====================================
If at first you don't succeed, you're about average.M2

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

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