0

I hope someone can help me with this. Basically I want to add this to my login script. The batch script needs to check if McAfee agent5 is installed. If its not exit. If it is installed to run the force install form the network share.

I have used the location where agent5 gets installed. I am not sure if there is a way to check the installed version instead?

The reason I cannot do this from EPO is I cant downgrade? Agent5 blocks it, unfortunately.

This is what I have but it does not work? What am I doing wrong here?

IF EXIST "C:\Program Files (x86)\McAfee\Common Framework\CmdAgent.exe"
GOTO :eof 
ELSE msiexec /i "\\192.168.55.125\McAfee Agent\FramePkg4.8.exe /install=agent /forceinstall" /s   
:eof   
END && EXIT
s0mePe0ple
  • 39
  • 2
  • 5
  • 1
    Whyt about reading the documentation of the used commands? open a new command prompt window, type `if /?` and read the help text very carefully! – aschipfl Oct 17 '16 at 17:34

2 Answers2

1

This is likely posted long after the OP's question is relevant for the OP. For those like me who need this answer presently, I figured it out after some tinkering. Here is my code to check if Google Chrome is installed, and if not, install it from a share. This can be replicated for any program provided you know the path to the .exe.

IF NOT EXIST "C:\Program Files\Google\Chrome\Application\chrome.exe" (
    u:\Software\PCSETUP\chrome\chromesetup.exe /silent /install
) ELSE (
    echo Chrome Already Installed!
)

U: in this case is my network share.

Cheers.

R3TURN-0
  • 83
  • 1
  • 9
0
set filepath=%~f1
set  file=%filepath:\=\\%
wmic datafile where name^="%file%" get version|findstr /i /v /c:"version"

File paths must be \\ not \ as normal. The second line doubles backslashes.

Use a for loop to get in a variable.

for /f "skip=1" %A in ('wmic datafile where name^="C:\\windows\\notepad.exe" get version') do Echo %A