Computing.Net > Forums > Programming > Batch file to check for .exe file

Batch file to check for .exe file

Reply to Message Icon

Original Message
Name: Sid3ways
Date: January 23, 2008 at 14:52:52 Pacific
Subject: Batch file to check for .exe file
OS: Windows XP
CPU/Ram: 2.6 Core 2 Duo / 2 GB
Model/Manufacturer: Dell E520
Comment:

Hello everyone! :)
Excellent forum you guys have here. I am trying to write a batch file here for work so I can check to see which PCs on my work network have a certain program installed. I'm actually checking to see if the SAP program is installed on a system. Since we have about a hundred PCs here I'd also like it to just spit out a text file with all of the PCs on the network that do not have SAP installed.

By the way it's installed @
C:\program files\SAP\

I'll be continually searching the forums here for more help but will appreciate any insight you can give. This is kind of my first attempt at jump into batch scripting and I hope to learn a lot from it.

Thanks in advance!


Report Offensive Message For Removal

Response Number 1
Name: Razor2.3
Date: January 23, 2008 at 18:48:37 Pacific
Subject: Batch file to check for .exe file
Reply: (edit)

Untested:

FOR /F %%a IN ('NET VIEW') DO IF NOT EXIST "%%a\C$\program files\SAP\whatever.exe" @ECHO %%a >> some.txt

You'll need admin powers on all of the PC's.

Report Offensive Follow Up For Removal

Response Number 2
Name: Sid3ways
Date: January 29, 2008 at 10:11:54 Pacific
Subject: Batch file to check for .exe file
Reply: (edit)

Wow the board never emailed me when you wrote that. Thank you so much for the push in the right direction Razor! I do not understand the ('NET VIEW') part you have in there, do I put the domain name in there or something?

I have about 100 computers to scan in a certain domain, how do I go about telling it to scan only the computers in that domain?


I ran this on my personal PC and it runs and creates the text file but it just says "There". Is there a way I can get it to spit out ip addresses of PCs that don't have it?


Report Offensive Follow Up For Removal

Response Number 3
Name: Razor2.3
Date: January 29, 2008 at 13:41:03 Pacific
Subject: Batch file to check for .exe file
Reply: (edit)

NET VIEW is a command. You can see what it does by opening a Command Prompt and typing it in. It should list all of the computers in your domain.

The FOR loop uses the first word on each line, so you'll have to run the command to see where FOR is getting a There.

do I put the domain name in there or something?
If you want to specify the domain, you'll need to modify the command to ('NET VIEW /DOMAIN:whatever').


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Batch file to check for .exe file

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software