Jump to content

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


Recommended Posts

Posted

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.

Posted

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

Posted

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:

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.

Posted

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 ?

Posted

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:

msiexec /i somefilename.msi /quiet /norestart

this installs the MSI quietly (no user interface) and doesn't reboot at the end.

Posted (edited)
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

Edited by beebs
Posted

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

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

 

 

 

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

 

http://db.tt/lTT3CI2

 

SMART CleanUp Utility v9.5.ini

[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.

 

http://db.tt/dXFQoLU

 

SMART CleanUp Utility v9.5.ini

[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? :)

Posted (edited)

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>UNINSTALL (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

Edited by Skinny
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...