Jump to content

Converting Batch-CMD Commands into AutoIt..?


Recommended Posts

Is there anyway to convert CMD-Batch commands into autoIt commands at all..??

If not then how do I pass commands from Autoit to be ran in CMD..??

I do not know if there is something like this.

Why do not you let in the same format (*.BAT) and run it from AutoIt.

When the words fail... music speaks.

Link to comment
Share on other sites

Is there anyway to convert CMD-Batch commands into autoIt commands at all..??

If not then how do I pass commands from Autoit to be ran in CMD..??

Hey cypher175,

You could post the Bat / Au3 example you are trying to achieve,

There are tons of ways to do what you wan't but it would help if you were

more specific.

There is a great deal to the CMD-Batch request.

You could also use an Au3 script to generate a bat on the fly, this would

help you make subtle changes to the bat file. Once finished you could delete it.

Ok tangent over :mellow:

Edited by Mobius

wtfpl-badge-1.png

Link to comment
Share on other sites

  • 10 months later...

Hi guys,

Sorry to bring this topic up again but i have a simple batch file which I want to place within an au3 file.

This is the commands in the bat file.

msiexec /qn /i t:\pcbackup\MEL\melagentsetup.msi ldapid=%username%

I have tried the follwing in the au3 script to no avail. I am not sure how to run the ldap part of it.

ShellExecute ('msiexec.exe /qn /i t:\pcbackup\BNE\BNEagentsetup.msi ldapid=%username%',"")

CheerS!

Link to comment
Share on other sites

Hi Danwilli,

You are a legend, it works!! However, only small problem. When using that format, the install splash screen I have which says Please wait while installing doesn't appear, only the "PCBackup has been successfully installed... appears straight away when the install kicks off and disappears before the install finishes. Do you know how to keep the "please wait while installing splash screen" on during the install, then disappears when the install is complete then launching the "PCbackup has been successfully installed" splash screen when the install is complete?

#include <array.au3>

#include <adfunctions.au3>

$user= _ADSamAccountNameToFQDN(@UserName)

If ProcessExists( "OUTLOOK.EXE" ) Then ExitMsg(0) EndIf ;close office apps

If ProcessExists( "WINWORD.EXE" ) Then ExitMsg(0) EndIf

If ProcessExists( "EXCEL.EXE" ) Then ExitMsg(0) EndIf

If ProcessExists( "POWERPNT.EXE" ) Then ExitMsg(0) EndIf

SplashTextOn("Installing", "Please wait while installing...",400,30, -1, -1, 0,"",12,700) ;splash text while installing

If FileExists("C:\Program Files\Iron Mountain\Connected BackupPC\CBUtil.dll") Then

$ver = FileGetVersion("C:\Program Files\Iron Mountain\Connected BackupPC\CBUtil.dll"); Get version of target file If file does not exist returns 0.0.0.0

if $ver < "8.2.2.5246" then ; Compare file version

Runwait('msiexec.exe /uninstall "T:\PCBackup\AgentSetup.msi" /passive');uninstall process

Configure() ;install process

Endif

Else

Configure()

EndIf

SplashOff()

ExitMsg(1)

Func Configure()

Select

Case _ADRecursiveISMemberOf (_ADSamAccountNametoFQDN("APP-PCBackup BNE"),$user)

ShellExecute("msiexec.exe", "/qn /i t:\pcbackup\BNE\BNEagentsetup.msi ldapid=" & @UserName)

Case _ADRecursiveISMemberOf (_ADSamAccountNametoFQDN("APP-PCBackup MEL"),$user)

ShellExecute("msiexec.exe", "/qn /i t:\pcbackup\MEL\MELagentsetup.msi ldapid=" & @UserName)

Case _ADRecursiveISMemberOf (_ADSamAccountNametoFQDN("APP-PCBackup SYD"),$user)

ShellExecute("msiexec.exe", "/qn /i t:\pcbackup\SYD\SYDagentsetup.msi ldapid=" & @UserName)

Case _ADRecursiveISMemberOf (_ADSamAccountNametoFQDN("APP-PCBackup CCO"),$user)

ShellExecute("msiexec.exe", "/qn /i t:\pcbackup\SYD\SYDagentsetup.msi ldapid=" & @UserName)

Case _ADRecursiveISMemberOf (_ADSamAccountNametoFQDN("APP-PCBackup SSO"),$user)

ShellExecute("msiexec.exe", "/qn /i t:\pcbackup\SYD\SYDagentsetup.msi ldapid=" & @UserName)

EndSelect

EndFunc

Func ExitMsg($closeCode)

Select

Case $closeCode = 0

MsgBox (16, "Warning", "Please close all Microsoft Office applications and then re-run this script. This includes Outlook, Word, Excel, and Powerpoint.")

Exit

Case $closeCode = 1

MsgBox (64, "Installation complete", "PCBackup has been successfully installed. You may now use MS Office programs",5)

Exit

EndSelect

EndFunc

Thanks again :D

Link to comment
Share on other sites

Either have the app watch for a specific window to know the install is done, or watch your process list durring the install... what is the last executable running durring the install? You could wait until that exists and then wait until it no longer exists to know that the install is finished.

Link to comment
Share on other sites

Hi there,

I only want the splash screen to appear during the select case install areas.

This part of the script here if it does run will have its own uninstall screen so no splash is needed.

If FileExists("C:\Program Files\Iron Mountain\Connected BackupPC\CBUtil.dll") Then

$ver = FileGetVersion("C:\Program Files\Iron Mountain\Connected BackupPC\CBUtil.dll"); Get version of target file If file does not exist returns 0.0.0.0

if $ver < "8.2.2.5246" then ; Compare file version

Runwait('msiexec.exe /uninstall "T:\PCBackup\AgentSetup.msi" /passive');uninstall process

However when it does go and run the configure() parts of the script, I want the splash to appear then close once it is completed

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...