Need to create a batch file

Microsoft Windows xp professional editio...
February 3, 2010 at 19:14:47
Specs: Windows XP
Hi All,

I am working in a MNC in which they have large number of servers.

Now I need to create a batch file by which I can get a path of a installed software.

Like:- abc.exe
Now I need to find the complete path of this abc.exe in all servers and that batch file give me the output in a text file including the host name.

For eg:-
Host Name:- XYZ
Complete path of ABC.exe :- c:\WINDOWS\system32\abc.exe

Please help

See More: Need to create a batch file

Report •

February 4, 2010 at 06:20:06
A simple...

dir abc.exe /b /s > foundabc.txt

would do the trick but in order to search each server you will need to either provide a text file with the IP addresses and or FQDN of the servers so that the batch file can read from this list. If you had such a text file then your code would be something like...

@echo off
echo Search for ABC.EXE > SearchResults.txt

For /F "tokens=* delims= " %%A in (iplist.txt) do (
  echo Host:%%A >> SearchResults.txt
  dir \\%%A\abc.exe /b /s >> SearchResults.txt

If you need the system to search through the IPs for a given range and subnet then you will need to go beyond batch scripting and look into Visual Basic Scripting.

The last issue is that you would have to be logged on as the Domain Admin to run such a script or you would run into authentication issues.

I know this was not much help but it should get you down the right track.

Report •
Related Solutions

Ask Question