Computing.Net > Forums > Programming > Batch files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch files

Reply to Message Icon

Name: atkadmin
Date: February 25, 2009 at 15:04:27 Pacific
OS: xp pro/server2k3
CPU/Ram: intel
Product: Dell / N/A
Subcategory: Batch
Comment:

Ok, I am having the toughest time with this. I need to find all the installs of a program on my network. this is what I have so far. the <computer> variable is for replacing with the real network computer name.

@echo off
IF EXIST "\\<computername>\c$\Program Files\EMGames\EMMedia1-3\dirs\playerwin.exe" GOTO :beer

ELSE IF GOTO :vodka

:beer

IF EXIST "\\<computername>\c$\program files\emgames\memedia4-6\dirs\playerwin.exe" GOTO :rum

ELSE IF GOTO :whiskey

:vodka

IF EXIST "\\<computername>\c$\program files\emgames\memedia4-6\dirs\playerwin.exe" GOTO :scotch

ELSE IF GOTO :bourbon

:rum

echo <computername>. >>z:\emgames1-6.txt

:whiskey

echo <computername>. >>z:\emgames1-3.txt

:scotch

echo <computername>. >>z:\emgames4-6.txt

:bourbon

echo <computername>. >>z:\emgamesnone.txt



Sponsored Link
Ads by Google

Response Number 1
Name: Holla
Date: February 25, 2009 at 20:41:59 Pacific
Reply:

I am sure you do not have angled brackets
around the computer name, right?
After each "echo computername. >>z:\filename"
put a statement called "goto :eof"

that should work.
Your exact problem is not clear btw.

--
Holla.


0

Response Number 2
Name: atkadmin
Date: February 26, 2009 at 05:29:08 Pacific
Reply:

I am sorry. I was just frustrated by the time I posted that I could not think straight. when I run it under it's current state against computers I know that have both files that I am looking for. both will show up in the emgames1-3.txt,emgames4-6.txt and the emgamesnone.txt files. so I know my if/else statements are not working right. I am trying to get it so that if the computer has just the 1-3 it shows up in that file if it has just the 4-6 then it shows up in that file. and if it has both then in the 1-6 file it will go. and if there is no emgames on the machine then it should go in the emgamesnone.txt. But it is not working properly. I know that it must be my syntax as I have not tried to write a batch file in many, many years and have forgotten most of it. So any help would be greatly appreciated.

Thanks in advance!


0

Response Number 3
Name: Holla
Date: March 2, 2009 at 01:42:05 Pacific
Reply:

You said it is not working properly.
Is it working improperly? How?
What is not working properly? The whole
batch file or commands within it? Which
commands?
Can you reduce the batch file to just one
single command that is not working and post
the response....

--
Holla.


0

Response Number 4
Name: Razor2.3
Date: March 2, 2009 at 05:12:10 Pacific
Reply:

Remove every instance of "ELSE IF", leaving just the GOTO <whatever>


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







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 files

Batch file to count a specific character in a www.computing.net/answers/programming/batch-file-to-count-a-specific-character-in-a/19751.html

FTP batch file www.computing.net/answers/programming/ftp-batch-file/9027.html

batch file www.computing.net/answers/programming/batch-file/13936.html