+ Post New Thread
Results 1 to 10 of 10
Scripts Thread, Looking to write .bat file to start a .exe file in Coding and Web Development; Hi Guys, I have been given a job to create a script that will allow me to start an executable ...
  1. #1
    beebs's Avatar
    Join Date
    Feb 2011
    Location
    Bishop's Stortford
    Posts
    15
    Thank Post
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Looking to write .bat file to start a .exe file

    Hi Guys,

    I have been given a job to create a script that will allow me to start an executable file from the server.

    I would like all Interactive Whiteboard Machines to execute 'board95cleanup.exe'

    This will uninstall smartboard 9.7. The reason for this: a couple of months ago i was asked to install smartboard 10. 9.7 became an issue as we couldnt uninstall this in the normal fashion via the RMMC.

    board95cleanup.exe works if done by hand. But this will take a lot of time.

    SMARTboard drivers and notebook version 10.x can be installed fine using the RMMC. i just need to get rid of SmartBoard 9.7 first.

    i have some experience using basic bat file codes but this is indeed a challenge for me!

    Can anyone help me out? Much Appreciated.

  2. #2
    steve's Avatar
    Join Date
    Oct 2005
    Location
    West Yorkshire
    Posts
    1,043
    Thank Post
    22
    Thanked 177 Times in 123 Posts
    Rep Power
    52
    I'm no expert in batch files but the rough process would be:

    Have batch file identify if computer is running v9.7 (either a file / folder check or in registry)
    if not present - end
    if present run exe
    check if removed ok
    run new setup

    Lots of batch file help here: Batch files

  3. #3

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    As the other Steve says, you can do all of this. Let's say that you know none of the machines have yet run the cleanup program and that you can have a machine startup script. In that script (a batch file) you put something like this:
    [code]
    if exist %windir%\97flag goto end
    start /wait \\server\share\board95cleanup.exe
    echo 97 removed > %windir%\97flag
    :end
    [code]
    What does it do? The first line checks to see if a flag file is present - if it is, this means that this process has already run so the program just ends.
    The next line does the work - it assumes you've got a share called "share" on a server called "server" - edit that to match your setup - and in that share you've got the cleanup program. the Start /wait just makes sure that it doesn't carry on until the program has finished.
    The last line writes some text to the flag file - this then means that the program won't run a second time.
    You could extend this - if you've got the new installer program in a suitable place that could run in the same way as the removal.

  4. #4
    soapyfish's Avatar
    Join Date
    Dec 2008
    Location
    Hertfordshire
    Posts
    180
    Thank Post
    49
    Thanked 7 Times in 5 Posts
    Blog Entries
    1
    Rep Power
    13
    Is there a way that you can enter keystrokes to the batch file without needing to use the keyboard.....I know that makes no senese really. so heres an example.

    1)Batch file runs program,
    2Program runs,
    3)Program prompts user to reboot or not,

    At the last stage I want the machine to reboot but I do not want to press the enter key to confirm that. I want to including a value in the batch file that will do that for me, Does anyone have any suggestions ?

  5. #5

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    yes - you can do this kind of thing with AutoIT but it's not always easy.

    It may be worth checking to see if the program can be started in a way which won't reboot.

    For example, if you're installing an MSI then you can do:
    Code:
    msiexec /i somefilename.msi /quiet /norestart
    this installs the MSI quietly (no user interface) and doesn't reboot at the end.

  6. #6
    soapyfish's Avatar
    Join Date
    Dec 2008
    Location
    Hertfordshire
    Posts
    180
    Thank Post
    49
    Thanked 7 Times in 5 Posts
    Blog Entries
    1
    Rep Power
    13
    Hi thanks for the quick reply,

    Its an exe file that runs and removes the smartboard software, it does not actually install anything,

  7. #7

    Join Date
    Dec 2007
    Location
    Nottinghamshire
    Posts
    189
    Thank Post
    60
    Thanked 21 Times in 19 Posts
    Rep Power
    17
    Is it really an exe or just a wrapper for an MSI try and open it using winrar or other tool, you might find an MSI in there.

  8. #8
    beebs's Avatar
    Join Date
    Feb 2011
    Location
    Bishop's Stortford
    Posts
    15
    Thank Post
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by notalot View Post
    Is it really an exe or just a wrapper for an MSI try and open it using winrar or other tool, you might find an MSI in there.
    i have extracted the msi's from the exe file. But still no luck, the installation fails straight away if i start one of the .msi
    Last edited by beebs; 7th February 2011 at 02:52 PM.

  9. #9


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    9,065
    Thank Post
    232
    Thanked 2,717 Times in 2,005 Posts
    Rep Power
    795
    I don't use the SMART Board software myself, but it looks like you have three options...

    1) Create a batch file like srochford's (or mine) and run it on each computer (either manually or automatically via another method). The command line switches shown in red below will run the cleanup utility without any user interaction. Once it has finished, the shutdown command will reboot the computer.

    Board95Cleanup.cmd
    Code:
    @echo off
    setlocal enabledelayedexpansion
    set SCRIPTDIR=%~dp0
    set SCRIPTDIR=%SCRIPTDIR:~0,-1%
    start "" /wait "%SCRIPTDIR%\board95cleanup.exe" /s /v"/qb"
    shutdown -r -t 10 -f


    2) Create a CC3 package which runs the EXE (and subsequently the MSI contained within).



    SMART CleanUp Utility v9.5.ini
    Code:
    [Package]
    Description=SMART CleanUp Utility v9.5 
    Version=1.0.0.0
    OS=5.WS,6.WS
    EXEFile=Board95Cleanup.exe
    AddCommand=/s /v"/qb"


    3) Create a CC3 package which runs the MSI you extracted from your %TEMP% folder. The ISSETUPDRIVEN=1 command should prevent the MSI (created with InstallShield ) from complaining.



    SMART CleanUp Utility v9.5.ini
    Code:
    [Package]
    Description=SMART CleanUp Utility v9.5 
    Version=1.0.0.0
    OS=5.WS,6.WS
    WIPackage=Board95Cleanup.msi
    AddCommand=ISSETUPDRIVEN=1
    Hope that helps?

  10. #10
    Skinny's Avatar
    Join Date
    Dec 2008
    Location
    Cheshire
    Posts
    47
    Thank Post
    5
    Thanked 2 Times in 2 Posts
    Rep Power
    12
    Surely there's an easier way?

    Personally I would just google for 'appdeploy smartboard 9.7' and look for the uninstall instruction.
    Here it is: AppDeploy > Software Knowledgebase > SMART Board Software 9.7.44.0
    and here is the auto uninstall code: MsiExec.exe /I{58D18628-7147-4782-B4E7-818C26D94DB5} MsiExec.exe /I{46486451-E60F-42C3-92D7-796D8594688A}

    If I can't find the uninstall string on appdeploy.com - for me personally the next step is to check the registry at:

    HKLM>SOFTWARE>MICRO$OFT>WINDOWS>CURRENTVERSION>UNI NSTALL (sorry for the caps) and get the uninstall string from there.

    For your silent/restart/user input options just goto Start>Run and type MSIEXEC and you will get a list of possibles to use.

    As the guys above said you could create a batch file along the lines of:

    if not exist="c:\program files\smartboard blah blah blah" goto end
    MsiExec.exe /I{58D18628-7147-4782-B4E7-818C26D94DB5} MsiExec.exe /I{46486451-E60F-42C3-92D7-796D8594688A} /qn /norestart
    :end
    exit


    although I think in this instance it's a waste of time including the conditional command (IF NOT) because the uninstall will not occur if the software is not found in this registry anyway.

    Hope it helps

    Skinny
    Last edited by Skinny; 12th February 2011 at 04:22 PM.

  11. Thanks to Skinny from:

    beebs (14th February 2011)

SHARE:
+ Post New Thread

Similar Threads

  1. Sims permissions bat file
    By ful56_uk in forum MIS Systems
    Replies: 21
    Last Post: 24th April 2010, 08:53 PM
  2. Bat file coding
    By tommccann in forum Windows
    Replies: 5
    Last Post: 31st March 2010, 11:41 AM
  3. .bat file clear old files
    By T_Noble in forum Coding
    Replies: 3
    Last Post: 20th January 2010, 12:03 PM
  4. BAT File issue
    By Danny159 in forum Windows Vista
    Replies: 2
    Last Post: 14th March 2009, 01:54 PM
  5. Stopping SQL using a Bat file
    By ful56_uk in forum Windows
    Replies: 4
    Last Post: 7th April 2008, 12:09 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
  •