Jump to content

RunOnceEX.cmd replacment


Recommended Posts

Will an autoit script run inplace of a runoneEX.cmd script..?

also how do I write these from my present runoncEX.cmd in autoit form. i have done regwrite's & reg deletes in autoit but canot work out how to write this lot.

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installing Applications" /f

REG ADD %KEY%02 /VE /D "BTS Driver Pack Finisher" /f

REG ADD %KEY%02 /V 1 /D "%SystemDrive%\DPsFnshr.exe" /f

REG ADD %KEY%02 /V 2 /D "reschangecon.exe -width=1024 -height=768 -depth=32" /f

REG ADD %KEY%10 /VE /D "Microsoft Office 2003" /f

REG ADD %KEY%10 /V 1 /D "%systemdrive%\install\Office2003install.cmd" /f

REG ADD %KEY%15 /VE /D "McAfee VirusScan Enterprise 8.0" /f

REG ADD %KEY%15 /V 1 /D "\"\\EBC-img-01\it$\Software\Other\McAfee\VirusScan Enterprise 8.0i cw Patch 13\setup.exe\" /qb" /f

Link to comment
Share on other sites

Here is a really old one I used to use on XP. Installs done from cd media.

$count = 1000
$key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx'
$cddrive = _FindCD('Win51', 0)
$dotnetfx = $cddrive & '\dotnetfx'
$software = $cddrive & '\software'
$tools = $cddrive & '\tools'


_Title('Installing Applications')
_Entry('Preparing Installation...',     $software & '\_Prepare.exe')
_Entry('Dotnet Framework v1.1 SP1',     $dotnetfx & '\_Dotnet.exe')
_Entry('Recovery Command Console',      $software & '\_CmdCons.exe')
_Entry('Windows Media Player v10.0',    $software & '\_Windows_Media_Player.exe')
_Entry('SunJava v1.4.1.02',             $software & '\_SunJava.exe')
_Entry('Adobe Acrobat Reader v7.0',     $software & '\_Adobe_Acrobat.exe')
_Entry('Advanced Disk Catalog v1.51',   $software & '\_Advanced_Disk_Catalog.exe')
_Entry('Autoit v3.1',                   $software & '\_Autoit.exe')
_Entry('CDCheck v3.1.3',                $software & '\_CDCheck.exe')
_Entry('EmotiPad Plus v1.37r',          $software & '\_EmotiPad_Plus.exe')
_Entry('FFDShow 28.08.2004',            $software & '\_ffdshow.exe')
_Entry('Free Downloader Manager v1.5',  $software & '\_Free_Download_Manager.exe')
_Entry('HideOE v1.1',                   $software & '\_HideOE.exe')
_Entry('IconSucker v2.19.115',          $software & '\_IconSucker.exe')
_Entry('Jane v1.44',                    $software & '\_Jane.exe')
_Entry('Maxthon Browser v1.2',          $software & '\_Maxthon.exe')
_Entry('PatchWise v3.29r',              $software & '\_PatchWise_Free.exe')
_Entry('Serials 2000 v7.1 Plus',        $software & '\_Serial2k.exe')
_Entry('Scite4AutoIt3 Feb 08,2005',     $software & '\_Scite4Autoit3.exe')
_Entry('Talking Messenger v3.1',        $software & '\_Talking_Messenger.exe')
_Entry('TinySpell v1.3',                $software & '\_TinySpell.exe')
_Entry('WinRAR 3.42',                   $software & '\_WinRAR.exe')
_Entry('Xplorer2 v1.0.0.3',             $software & '\_Xplorer2.exe')
_Entry('Avast! 4 Home v4.5.549',        $software & '\_Avast.exe')
_Entry('Additional Desktop Themes',     $software & '\_Themes.exe')
_Entry('Clean up',                      $software & '\_Cleanup.exe')

Func _Title($title)
    RegWrite($key, 'Title', 'Reg_sz', $title)
EndFunc

Func _Entry($title, $file)
    $count = $count + 1
    RegWrite($key & '\' & $count, '', 'Reg_sz', $title)
    RegWrite($key & '\' & $count, '1', 'Reg_sz', $file)
EndFunc

Func _FindCD($name, $option)
    ; e.g. _FindCD('Setup.exe', 0) or _FindCD('CD Title', 1)
    ; $option: 0 = Filename in CD Root ; 1 = CD title
    Local $cddrive
    While Not $cddrive
        $drvs = DriveGetDrive('CDROM')
        If Not @error Then
            For $i = 1 To $drvs[0]
                If DriveStatus($drvs[$i] & '\') = 'READY' Then
                    If $option = 0 Then
                        If FileExists($drvs[$i] & '\' & $name) Then
                            $cddrive = $drvs[$i]
                            Return $cddrive
                        EndIf
                    ElseIf $option = 1 Then
                        $cddrive = $drvs[$i]
                        If DriveGetLabel($cddrive) = $name Then
                            Return $cddrive
                        EndIf
                    EndIf
                EndIf
            Next
            If Not $cddrive Then
                If MsgBox(21, 'Warning', 'Please insert CD into a drive now') = 2 Then
                    Sleep(1000)
                    If MsgBox(36, 'Important', 'Are you sure that you want to exit') = 6 Then Exit
                EndIf
                Sleep(2000)
            EndIf
        EndIf
    WEnd
EndFunc

I got sick of making typo's which caused error so I moved onto searching for the scripts rather then typing out their paths manually as I do here.

:shocked:

Link to comment
Share on other sites

Not tested, but his is your reg stuff converted:

$RegKey =  'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx'
RegWrite($RegKey,'TITLE','REG_SZ','Installing Applications')
RegWrite($RegKey&'02','','REG_SZ','BTS Driver Pack Finisher')
RegWrite($RegKey&'02','1','REG_SZ','%SystemDrive%\DPsFnshr.exe')
RegWrite($RegKey&'02','2','REG_SZ','reschangecon.exe -width=1024 -height=768 -depth=32')

RegWrite($RegKey&'10','','REG_SZ','Microsoft Office 2003')
RegWrite($RegKey&'10','1','REG_SZ','%systemdrive%\install\Office2003install.cmd')

RegWrite($RegKey&'15','','REG_SZ','McAfee VirusScan Enterprise 8.0')
RegWrite($RegKey&'15','1','REG_SZ','\"\\EBC-img-01\it$\Software\Other\McAfee\VirusScan Enterprise 8.0i cw Patch 13\setup.exe\" /qb')
----[ SandyD ]---
Link to comment
Share on other sites

Your commands converted can be like this

$KEY = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx'
$software = EnvGet('systemdrive')

_Title("Installing Applications")
_Entry('BTS Driver Pack Finisher', $software & '\DPsFnshr.exe', "reschangecon.exe -width=1024 -height=768 -depth=32")
_Entry('Microsoft Office 2003', $software & '\install\Office2003install.cmd')
_Entry('McAfee VirusScan Enterprise 8.0', '"\\EBC-img-01\it$\Software\Other\McAfee\VirusScan Enterprise 8.0i cw Patch 13\setup.exe" /qb')

Func _Title($title)
    RegWrite($key, 'Title', 'Reg_sz', $title)
EndFunc

Func _Entry($title, $file, $file2 = '')
    $count = $count + 1
    RegWrite($key & '\' & $count, '', 'Reg_sz', $title)
    RegWrite($key & '\' & $count, '1', 'Reg_sz', $file)
    If $file2 <> '' Then
        RegWrite($key & '\' & $count, '2', 'Reg_sz', $file)
    EndIf
EndFunc
Edited by MHz
Link to comment
Share on other sites

can you see any problems with my full runonce script.

$KEY = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx'
$software = EnvGet('systemdrive')

_Title("Installing Applications")
_Entry('BTS Driver Pack Finisher', $software & '\DPsFnshr.exe', "\windows\system32\reschangecon.exe -width=1024 -height=768 -depth=32")
_Entry('Microsoft Office 2003', $software & '"\\EBC-img-01\it$\Software\Office\Office 2003\CD1\setup.exe" TRANSFORMS="\\EBC-img-01\it$\Software\Office\Office 2003\cd1\New Custom Setup File.MST" /qb-')
_Entry('McAfee VirusScan Enterprise 8.0i', '"\\EBC-img-01\it$\Software\Other\McAfee\VirusScan Enterprise 8.0i cw Patch 13\setup.exe" /qb')
_Entry('McAfee EPO Agent', '"\\EBC-img-01\it$\Software\Other\McAfee\EPOAgent.exe\" /silent')
_Entry('Adobe Reader 8.0', $software & 'Install\reader8.exe')
_Entry('Macromedia Authoware 7.0', '"\install\AWAX_Full_Installer.EXE" /s')
_Entry('Macromedia Shockwave 10.1.4.020', '\install\Swinstaller.exe')
_Entry('Cleanup', '"REGEDIT /s %WINDIR%\system32\regcleanup.reg"', '"REGEDIT /s %WINDIR%\system32\RemoveAutoLogin.reg"')
_Entry('Defragmentation', $software & '\windows\system32\defrg.exe', '\windows\system32\defrg.exe')
_Entry('Restart Computer', $software & '\windows\system32\restart.cmd')

Func _Title($title)
    RegWrite($key, 'Title', 'Reg_sz', $title)
EndFunc

Func _Entry($title, $file, $file2 = '')
    $count = $count + 1
    RegWrite($key & '\' & $count, '', 'Reg_sz', $title)
    RegWrite($key & '\' & $count, '1', 'Reg_sz', $file)
    If $file2 <> '' Then
        RegWrite($key & '\' & $count, '2', 'Reg_sz', $file)
    EndIf
EndFunc
Link to comment
Share on other sites

Just add Global $count at the begining of your script:

Global $count
$KEY = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx'
$software = EnvGet('systemdrive')

_Title("Installing Applications")
_Entry('BTS Driver Pack Finisher', $software & '\DPsFnshr.exe', "\windows\system32\reschangecon.exe -width=1024 -height=768 -depth=32")
_Entry('Microsoft Office 2003', $software & '"\\EBC-img-01\it$\Software\Office\Office 2003\CD1\setup.exe" TRANSFORMS="\\EBC-img-01\it$\Software\Office\Office 2003\cd1\New Custom Setup File.MST" /qb-')
_Entry('McAfee VirusScan Enterprise 8.0i', '"\\EBC-img-01\it$\Software\Other\McAfee\VirusScan Enterprise 8.0i cw Patch 13\setup.exe" /qb')
_Entry('McAfee EPO Agent', '"\\EBC-img-01\it$\Software\Other\McAfee\EPOAgent.exe\" /silent')
_Entry('Adobe Reader 8.0', $software & 'Install\reader8.exe')
_Entry('Macromedia Authoware 7.0', '"\install\AWAX_Full_Installer.EXE" /s')
_Entry('Macromedia Shockwave 10.1.4.020', '\install\Swinstaller.exe')
_Entry('Cleanup', '"REGEDIT /s %WINDIR%\system32\regcleanup.reg"', '"REGEDIT /s %WINDIR%\system32\RemoveAutoLogin.reg"')
_Entry('Defragmentation', $software & '\windows\system32\defrg.exe', '\windows\system32\defrg.exe')
_Entry('Restart Computer', $software & '\windows\system32\restart.cmd')

Func _Title($title)
    RegWrite($key, 'Title', 'Reg_sz', $title)
EndFunc

Func _Entry($title, $file, $file2 = '')
    $count = $count + 1
    RegWrite($key & '\' & $count, '', 'Reg_sz', $title)
    RegWrite($key & '\' & $count, '1', 'Reg_sz', $file)
    If $file2 <> '' Then
        RegWrite($key & '\' & $count, '2', 'Reg_sz', $file)
    EndIf
EndFunc
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

Just add Global $count at the begining of your script:

Thanks for the reminder. It needs to have a big number or you get the 1, 10, 2, 3, ... effect so entries get mixed in different order then scripted.

Expand Environmental String looks needed also that I see so I will use it to the maximum.

Opt('ExpandEnvStrings', 1)
$count = 1000
$key = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx'

_Title('Installing Applications')
_Entry('BTS Driver Pack Finisher', '%SYSTEMDRIVE%\DPsFnshr.exe', '%SYSTEMROOT%\system32\reschangecon.exe -width=1024 -height=768 -depth=32')
_Entry('Microsoft Office 2003', '"\\EBC-img-01\it$\Software\Office\Office 2003\CD1\setup.exe" ' & _
        'TRANSFORMS="\\EBC-img-01\it$\Software\Office\Office 2003\cd1\New Custom Setup File.MST" /qb-')
_Entry('McAfee VirusScan Enterprise 8.0i', '"\\EBC-img-01\it$\Software\Other\McAfee\VirusScan Enterprise 8.0i cw Patch 13\setup.exe" /qb')
_Entry('McAfee EPO Agent', '"\\EBC-img-01\it$\Software\Other\McAfee\EPOAgent.exe\" /silent')
_Entry('Adobe Reader 8.0', '%SYSTEMDRIVE%\Install\reader8.exe')
_Entry('Macromedia Authoware 7.0', '"%SYSTEMDRIVE%\install\AWAX_Full_Installer.EXE" /s')
_Entry('Macromedia Shockwave 10.1.4.020', '%SYSTEMDRIVE%\install\Swinstaller.exe')
_Entry('Cleanup', 'REGEDIT /s %SYSTEMROOT%\system32\regcleanup.reg', 'REGEDIT /s %SYSTEMROOT%\system32\RemoveAutoLogin.reg')
_Entry('Defragmentation', '%SYSTEMROOT%\system32\defrg.exe')
_Entry('Restart Computer', '%SYSTEMROOT%\system32\restart.cmd')

Func _Title($title)
    RegWrite($key, 'Title', 'Reg_sz', $title)
EndFunc

Func _Entry($title, $file, $file2 = '')
    $count = $count + 1
    RegWrite($key & '\' & $count, '', 'Reg_sz', $title)
    RegWrite($key & '\' & $count, '1', 'Reg_sz', $file)
    If $file2 <> '' Then
        RegWrite($key & '\' & $count, '2', 'Reg_sz', $file)
    EndIf
EndFunc

:shocked:

Edited by MHz
Link to comment
Share on other sites

Cheers Mhz & others.

Thanks for the reminder. It needs to have a big number or you get the 1, 10, 2, 3, ... effect so entries get mixed in different order then scripted.

Expand Environmental String looks needed also that I see so I will use it to the maximum.

Opt('ExpandEnvStrings', 1)
$count = 1000
$key = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx'

_Title('Installing Applications')
_Entry('BTS Driver Pack Finisher', '%SYSTEMDRIVE%\DPsFnshr.exe', '%SYSTEMROOT%\system32\reschangecon.exe -width=1024 -height=768 -depth=32')
_Entry('Microsoft Office 2003', '"\\EBC-img-01\it$\Software\Office\Office 2003\CD1\setup.exe" ' & _
        'TRANSFORMS="\\EBC-img-01\it$\Software\Office\Office 2003\cd1\New Custom Setup File.MST" /qb-')
_Entry('McAfee VirusScan Enterprise 8.0i', '"\\EBC-img-01\it$\Software\Other\McAfee\VirusScan Enterprise 8.0i cw Patch 13\setup.exe" /qb')
_Entry('McAfee EPO Agent', '"\\EBC-img-01\it$\Software\Other\McAfee\EPOAgent.exe\" /silent')
_Entry('Adobe Reader 8.0', '%SYSTEMDRIVE%\Install\reader8.exe')
_Entry('Macromedia Authoware 7.0', '"%SYSTEMDRIVE%\install\AWAX_Full_Installer.EXE" /s')
_Entry('Macromedia Shockwave 10.1.4.020', '%SYSTEMDRIVE%\install\Swinstaller.exe')
_Entry('Cleanup', 'REGEDIT /s %SYSTEMROOT%\system32\regcleanup.reg', 'REGEDIT /s %SYSTEMROOT%\system32\RemoveAutoLogin.reg')
_Entry('Defragmentation', '%SYSTEMROOT%\system32\defrg.exe')
_Entry('Restart Computer', '%SYSTEMROOT%\system32\restart.cmd')

Func _Title($title)
    RegWrite($key, 'Title', 'Reg_sz', $title)
EndFunc

Func _Entry($title, $file, $file2 = '')
    $count = $count + 1
    RegWrite($key & '\' & $count, '', 'Reg_sz', $title)
    RegWrite($key & '\' & $count, '1', 'Reg_sz', $file)
    If $file2 <> '' Then
        RegWrite($key & '\' & $count, '2', 'Reg_sz', $file)
    EndIf
EndFunc

:shocked:

Link to comment
Share on other sites

  • 1 year later...

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