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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Batch file to check for .exe file

Reply to Message Icon

Name: Sid3ways
Date: January 23, 2008 at 14:52:52 Pacific
OS: Windows XP
CPU/Ram: 2.6 Core 2 Duo / 2 GB
Product: 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!



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: January 23, 2008 at 18:48:37 Pacific
Reply:

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.

0

Response Number 2
Name: Sid3ways
Date: January 29, 2008 at 10:11:54 Pacific
Reply:

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?


0

Response Number 3
Name: Razor2.3
Date: January 29, 2008 at 13:41:03 Pacific
Reply:

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').


0
Reply to Message Icon

Related Posts

See More


count lines do action on ... batch file to delete fold...



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch file to check for .exe file

Bat file to check for multiple files www.computing.net/answers/programming/bat-file-to-check-for-multiple-files/19129.html

how to check for memmory leaks www.computing.net/answers/programming/how-to-check-for-memmory-leaks/4958.html

how to check batch file www.computing.net/answers/programming/how-to-check-batch-file/2856.html