Jump to content
Sign in to follow this  
stev379

Batch to AutoIT install script

Recommended Posts

stev379

Hello,

Assuming the files and folders are in the correct locations, is the conversion from batch to AutoIT below correct?

Is it the best 'correct' option? --> Would it be wiser to fileinstall the batch file and just run it?

The original batch is below the AutoIT code.

I'm building this install blind. I don't have access to the app itself and the developers are out of reach for a couple days.

Run(@ComSpec & " /c cd\")
Run(@ComSpec & " /c cd c:\dist")
Run(@ComSpec & " /c xcopy /csyi ""WINDOWS"" ""%WINDIR%\""")
Run(@ComSpec & " /c pushd ""%WINDIR%\Downloaded Program Files""")
Run(@ComSpec & " /c regsvr32 /s hwau.dll")
Run(@ComSpec & " /c reg import hwau.reg")
Run(@ComSpec & " /c reg import hwau-2.reg")
Run(@ComSpec & " /c popd")
Run(@ComSpec & " /c xcopy /csyi ""Program Files"" ""\Program Files\""")
Run(@ComSpec & " /c pushd ""c:\Program Files\BizFlow\bin""")
Run(@ComSpec & " /c for %%f in (*.ocx *.dll) do regsvr32 /s %%f")
Run(@ComSpec & " /c reg import hwwih.reg")
Run(@ComSpec & " /c reg import bff-1.reg")
Run(@ComSpec & " /c reg import bff-2.reg")
Run(@ComSpec & " /c popd")

ORIGINAL BATCH

cd\

cd C:\dist

xcopy /csyi "WINDOWS" "%WINDIR%\"

pushd "%WINDIR%\Downloaded Program Files"

regsvr32 /s hwau.dll

reg import hwau.reg

reg import hwau-2.reg

popd

xcopy /csyi "Program Files" "\Program Files\"

pushd "c:\Program Files\BizFlow\bin"

for %%f in (*.ocx *.dll) do regsvr32 /s %%f

reg import hwwih.reg

reg import bff-1.reg

reg import bff-2.reg

popd

Thanks for any help or suggestions.

-Steve

Share this post


Link to post
Share on other sites
JLogan3o13

Hi, stev379. I would say you could do the entire script without resorting to Comspec at all. For example:

Run(@ComSpec & " /c xcopy /csyi ""WINDOWS"" ""%WINDIR%""")

Check the Dir Copy function in the help file for this

Run(@ComSpec & " /c pushd ""%WINDIR%Downloaded Program Files""")
Run(@ComSpec & " /c pushd ""c:Program FilesBizFlowbin""")

Rather than the pushd command, store these directories as local variables.

Run(@ComSpec & " /c for %%f in (*.ocx *.dll) do regsvr32 /s %%f")

Look at the help file for using a FOR loop to loop through the necessary file types and register them.

Run(@ComSpec & " /c reg import hwwih.reg")
Run(@ComSpec & " /c reg import bff-1.reg")
Run(@ComSpec & " /c reg import bff-2.reg")

You should be able to use the Run command, something like this:

Run("REGEDIT /S hwwih.reg")

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
stev379

That should make it much easier. They sent me the wrong install and the correct one is far more robust so doing things this way should make it go much quicker. Signifigantly more files to register now so a For loop is the way to go ...and maybe build an array in case I need to add to this install in the future.

Love AutoIT. Wish I could spend more than a few weeks a year working with it.

Thanks!

Share this post


Link to post
Share on other sites
JLogan3o13

Another suggestion, if you would like to configure the install once and then deploy is to repackage it into an MSI. There are many tools out there that will allow you to do this; some free (Wix) and some not free but more robust (Admin Studio). Once you package the install into an MSI, with any customizations you would like, you can then run the install with a simple ShellExecute in an AutoIT script.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
stev379

Another suggestion, if you would like to configure the install once and then deploy is to repackage it into an MSI. There are many tools out there that will allow you to do this; some free (Wix) and some not free but more robust (Admin Studio). Once you package the install into an MSI, with any customizations you would like, you can then run the install with a simple ShellExecute in an AutoIT script.

Your timing is impeccable. I'm working on a similar deployment using a 3rd party deployment tool that works best with MSI's. Budget cuts won't let me spend anything right now, but this would be a fairly basic conversion so hopefully one of the free options will suffice.

Thanks!

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×