+ Post New Thread
Results 1 to 9 of 9
Coding Thread, Need help with a batch script! in Coding and Web Development; Trying to force an MSI out to the remaining computers which seem to be playing stubborn installing Chrome with software ...
  1. #1
    Chaddy's Avatar
    Join Date
    Nov 2012
    Location
    Orrell, Greater Manchester
    Posts
    34
    Thank Post
    8
    Thanked 3 Times in 2 Posts
    Rep Power
    4

    Need help with a batch script!

    Trying to force an MSI out to the remaining computers which seem to be playing stubborn installing Chrome with software installation GPO, so going to do it with a script instead.
    However I'm not getting anywhere with this script so far, and I don't know what I'm doing wrong

    Code:
    @echo off
    
    Set File="C:\%programfiles%\Google\Chrome\Application\chrome.exe"
    
    
    If Not Exist %file% Goto Google
    
    
    If Exist %File% Goto TheEnd
    
    
    :Google
    msiexec /package "\\SERVER\SOFTWARE\GOOGLEAPPS\GoogleChrome\GoogleChromeStandaloneEnterprise.msi" /quiet
    
    
    
    
    :TheEnd 
    echo Chrome exists!
    Regards,
    Chaddy

  2. #2
    BKGarry's Avatar
    Join Date
    Mar 2006
    Location
    Kent
    Posts
    908
    Thank Post
    92
    Thanked 118 Times in 95 Posts
    Rep Power
    46
    Does the set file need to have c:\ specified before the program files variable, as that may be causing two incidents of C:\ to be showing in the script

  3. #3

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,686
    Thank Post
    334
    Thanked 513 Times in 481 Posts
    Rep Power
    178
    May be missing the obvious, but you didn't tell it to install?

    msiexex /i "PackageName" etc? Your line /package doesn't do anything as far as I know unless I'm being stupid this morning

    *Edit - Seems it does work on some versions with /package too, so ignore me!

    Steve

  4. #4
    themightymrp's Avatar
    Join Date
    Dec 2009
    Location
    Leeds, West Yorkshire
    Posts
    1,183
    Thank Post
    206
    Thanked 221 Times in 190 Posts
    Rep Power
    72
    I would normally use the syntax of

    msiexec /I "package source" /q

    But looking at your script it seems to be viable? When you say its not working, does it fail straight away? Could it be anything to do with 64bit windows? As in, is it trying to install to "C:\Program Files (x86)" ?

  5. #5
    Guest

    Join Date
    Jun 2009
    Posts
    3,754
    Thank Post
    1,458
    Thanked 489 Times in 375 Posts
    Rep Power
    0
    You may also want to take into account 64-bit devices (if you have them) as Chrome will be installed to %ProgramFiles(x86)%.

    Also, @BKGarry is right, remove the C: from the SET FILE line as it's included in the %ProgramFiles% variable path.
    Last edited by Rawns; 17th June 2013 at 11:33 AM.

  6. #6


    tom_newton's Avatar
    Join Date
    Sep 2006
    Location
    Leeds
    Posts
    4,461
    Thank Post
    866
    Thanked 845 Times in 667 Posts
    Rep Power
    195
    Possibly better to look in the registry for installed s/w rather than the filesystem?

  7. #7


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    8,709
    Thank Post
    220
    Thanked 2,615 Times in 1,926 Posts
    Rep Power
    777
    Try this...

    Code:
    @ECHO OFF
    
    IF DEFINED ProgramFiles(x86) (
       :: 64-bit OS
       Set CHROME="%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe"
    ) ELSE (
       :: 32-bit OS
       Set CHROME="%ProgramFiles%\Google\Chrome\Application\chrome.exe"
    )
    
    IF NOT Exist %CHROME% msiexec /i "\\SERVER\SOFTWARE\GOOGLEAPPS\GoogleChrome\GoogleChromeStandaloneEnterprise.msi" NOGOOGLEUPDATEPING=1 REBOOT=ReallySuppress /QN

  8. #8
    Chaddy's Avatar
    Join Date
    Nov 2012
    Location
    Orrell, Greater Manchester
    Posts
    34
    Thank Post
    8
    Thanked 3 Times in 2 Posts
    Rep Power
    4
    Removing the drive letter sorted it, I wasn't aware that the programfiles variable included. I should of known that tbh, silly me.

    Thanks Arthur, I may look at that in the future, but atm isn't necessary as our machines are all 32bit.

    Thanks for the help guys!
    Last edited by Chaddy; 18th June 2013 at 07:41 AM.

  9. #9


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    8,709
    Thank Post
    220
    Thanked 2,615 Times in 1,926 Posts
    Rep Power
    777
    Quote Originally Posted by Chaddy View Post
    I may look at that in the future, but atm isn't necessary as our machines are all 32-bit.
    The batch file will still work even if you only ever use it on 32-bit OSs.

SHARE:
+ Post New Thread

Similar Threads

  1. Need help with batch files please!
    By richrad_mills in forum Windows
    Replies: 13
    Last Post: 23rd June 2010, 07:24 PM
  2. Need help with this damn "job evaluation"..
    By Oops_my_bad in forum General Chat
    Replies: 3
    Last Post: 4th May 2008, 07:26 PM
  3. need help with wsus 3.0 urgent
    By goodhead in forum Windows
    Replies: 10
    Last Post: 2nd October 2007, 10:42 AM
  4. need help with few A+ core questions
    By projector1 in forum General Chat
    Replies: 24
    Last Post: 26th February 2007, 12:08 PM
  5. A Few Things I Need Help With
    By Pear in forum Windows
    Replies: 11
    Last Post: 13th October 2005, 07:42 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •