Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Windows Batch File

  • 05-06-2013 4:07pm
    #1
    Registered Users, Registered Users 2 Posts: 13,385 ✭✭✭✭


    Hi all,

    I'm sure there are many requests for help with writing of windows batch files but I'm looking for some troubleshooting as per where I'm going wrong with the below batch command.

    I've been asked to install the latest versions of browsers on a number of PCs and the easiest way to do this is to create a batch and forward it to them to run the install themselves.

    My syntax is:
    Start /w \\ServerName\Browser_Files\27.0.1453.110_chrome_installer /quiet
    Start /w \\ServerName\downloadstechnical$\Browser_Files\Firefox21.exe /s
    Start /w \\ServerName\downloadstechnical$\Browser_Files\IE10-Windows6.1-x86-en-us /quiet


    The batch runs properly, executes each line and finishes without error. However, only Mozilla Firefox installs.

    Initially IE10 gave an error stating that the syntax was wrong but changing /q to /quiet solved this.

    I'd appreciate some input as per where I'm going wrong, also if this belongs in a different forum then apologies in advance!


Comments

  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 93,857 Mod ✭✭✭✭Capt'n Midnight


    Don't kill yourself on batch files because they'll change the command synthax on the next version of the app.

    psexec -c can do wonders,

    https://ninite.com/ - non commercial

    http://unattended.sourceforge.net/installers.php

    http://www.itninja.com/


  • Moderators, Arts Moderators, Regional Abroad Moderators Posts: 11,129 Mod ✭✭✭✭Fysh


    I couldn't swear this is the cause of your problem, but I know some installers won't allow an installation from a remote location.

    To get around it, use xcopy to copy the installation files to a local directory - ideally a randomised one that's deleted on exit. Something like:
    set initdir=%cd%
    set tmpdir=%systemdrive%\%random%
    set logfile=%systemdrive%\logfile.txt
    :: Sets current location to variable initdir, creates random temp dir as variable tmpdir
    mkdir %tmpdir%
    xcopy \\ServerName\Browser_Files\27.0.1453.110_chrome_installer.exe %tmpdir% 
    xcopy \\ServerName\downloadstechnical$\Browser_Files\Firefox21.exe %tmpdir%
    xcopy \\ServerName\downloadstechnical$\Browser_Files\IE10-Windows6.1-x86-en-us %tmpdir%
    :: creates temp directory, copies files from file share
    if exist %tmpdir%\27.0.1453.110_chrome_installer.exe (
    start /wait 27.0.1453.110_chrome_installer.exe /quiet) else (echo %date% %time%: Chrome installer 27.0.1453.110 not found >> %logfile%)
    if exist %tmpdir%\Firefox21.exe (
    start /wait Firefox21.exe -ms) else (echo %date% %time%: Firefox 21 installer not found >> %logfile%)
    if exist %tmpdir%\IE10-Windows6.1-x86-en-us (
    start /wait IE10-Windows6.1-x86-en-us /quiet) else (echo %date% %time%: Internet Explorer 10 installer not found >> %logfile%)
    cd %initdir%
    rmdir /s /q %tmpdir%
    

    You can expand on this in many ways if you want, but it's only worth it if you expect to have to deploy a lot of software in this way.

    If you do expect to have to deploy a lot of software this way, I would suggest configuring a logon script to run on all machines. That script should copy a text file with your inventory of current applications, check whether they're installed, grab the installer if not, then install it and delete the installer.

    This will take a fair amount of time to do (especially to test and make sure it's working properly, but also to find the right silent-install switches to use for each package). Unless you need to support WinXP machines with the same code, a better approach would be to build it with PowerShell - it's much more robust and flexible.


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 93,857 Mod ✭✭✭✭Capt'n Midnight


    Fysh wrote: »
    I couldn't swear this is the cause of your problem, but I know some installers won't allow an installation from a remote location.
    it crops up so often that you might as well xcopy /d the file across into the temp folder. Making your own c:\temp means you never have to ask if you can clean it out later.
    or at the very least make sure you assign a drive letter to the path the file is on. No you shouldn't have to do this since UNC names became popular but..


Advertisement