If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Please, I don't mean to be rude, but if you have to ask me what a part of my batch file does, then please don't reply. In short, I need to turn my batch file that runs against one IP at a time to a batch file that runs against an input file, i.e .txt.

I'm unsure of how to read input from a text file in a batch program, but it seems that since your batch file works for one host at a time, you could write a C/C++ program that calls your batch file and passes the correct IP from the text-file as an argument to the batch file by concatrating/combining strings of the command (name of batch file) with the argument (IP read from file) and calls that with the "system()" command. I think you need to include windows.h or something for that to work. So basically the C/C++ program would do the task of calling it repeatedly for each IP in your text file.

I took the time to code it out since you appear to have a non-malicious need for code, since it seems pretty obvious that you need admin privilages to carry out what you are doing anyways. Please note that you will need to recompile it to call your batch file, as my example uses the ECHO command. Simply replace line 9's echo ( char batchprogram[16] = "echo "; ) with the name of your batch file and it should work fine. And it does need to be called from the command line since for some reason it doesn't quite work as expected when double-clicked through the GUI goodness of Windows. I hope that you can use this. And if there are any weird bugs in the code...hopefully you can find them and fix them yourself

In another batch file:
for /f "usebackq" %%i in (`type ip_list.txt`) do @your_batch_file %%i
( just replace %i with %%i )

ip_list.txt contains list of IP addressess, one IP per line.

For more info:
C:\&gt; for /?

I didn't know that sysinternal's pslist can take process id or name as argument, cool... I think I can modify your batch file a bit and make a good use of it.

Peace always,&lt;jdenny&gt;

Always listen to experts. They\'ll tell you what can\'t be done and why. Then go and do it. -- Robert HeinleinI\'m basically a very lazy person who likes to get credit for things other people actually do. -- Linus Torvalds