Jump to content
Sign in to follow this  
sutefan

Replace a batch file with a autoit .exe

Recommended Posts

Hello,

I am new to autoit and downloaded on the recommendation from several sources including novell.com. As a network administrator one of my duties to ensure anti-virus is kept up to date, generally this taken care by central administration without any issues. This however does not help with remote users. Sophos the av provider recommendation was to create a batch file as follows, which uses wget to download a file before the update to processed. Can I achive the same result with AutoIt?

The batch file we are currently using is as follows:

@echo off

C:

CD C:\SOPHIDE

DEL *.IDE

DEL IDES.EXE

WGET http://www.sophos.com/downloads/ide/ides.exe

IDES.EXE

COPY /Y *.IDE C:\Progra~1\Sophos~1\

NET STOP SWEEPSRV.SYS

NET START SWEEPSRV.SYS

wget is a standalone program that resides in the same directory as the batch file and used to download the ides.exe file from Sophos' website.

So far I've only done the helloworld and a small utility to display Computer Name and IP in a message box so my AutoIt knowledge is limited :">

Any help or suggestions appreciated!

Sutefan

Edited by sutefan

これは私の署名であり, 私の名前はsutefan である !

Share this post


Link to post
Share on other sites

I just converted it for you.

More info about the functions is available in the help file.

FileDelete('C:\SOPHIDE\*.IDE')
FileDelete('C:\SOPHIDE\IDES.EXE')
InetGet('http://www.sophos.com/downloads/ide/ides.exe', 'C:\SOPHIDE\IDES.EXE', 1)
RunWait('C:\SOPHIDE\IDES.EXE')
FileCopy('C:\SOPHIDE\*.IDE', 'C:\Progra~1\Sophos~1\', 1)
RunWait('NET STOP SWEEPSRV.SYS', '', @SW_HIDE)
RunWait('NET START SWEEPSRV.SYS', '', @SW_HIDE)

Share this post


Link to post
Share on other sites

Excellent :lmao: Much appreciated

Have some more questions but I want to lookup those functions so that I understand what's happening.

Thanks Again

Sutefan


これは私の署名であり, 私の名前はsutefan である !

Share this post


Link to post
Share on other sites

Based on SlimShady's post :lmao:

Line-by-line translation with closest equivalents. Untested, so be careful with FileDelete!

#NoTrayIcon
; the C: line is not needed
FileChangeDir("C:\SOPHIDE")
FileDelete("*.IDE")
FileDelete("IDES.EXE')
RunWait("WGET http://www.sophos.com/downloads/ide/ides.exe","",@SW_HIDE)
RunWait('C:\SOPHIDE\IDES.EXE')
FileCopy('C:\SOPHIDE\*.IDE', 'C:\Progra~1\Sophos~1\', 1)
RunWait('NET STOP SWEEPSRV.SYS', '', @SW_HIDE)
RunWait('NET START SWEEPSRV.SYS', '', @SW_HIDE)
Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

My first question :)

Can Environmental Variables be used in AutoIt? So in this case for the above script I would want to replace all instances of C:\SOPHIDE with %TEMP% and %SystemDrive%.

I've tried this but the Auto SyntaxCheck in SciTE says there are 0 error but when I do a check run it comes up with the following error:

(5) : ==> Unable to execute the external program.:

RunWait('%TEMP%\IDES.EXE')

The system cannot find the file specified.

I assume this is because there is no ides.exe file in %TEMP%. So I moved the FileDelete lines down to the bottom of the script so the files are deleted after the update is complete.

This also fails with the same error as above.

#NoTrayIcon
InetGet('http://www.sophos.com/downloads/ide/ides.exe', '%TEMP%\IDES.EXE', 1)
RunWait('%TEMP%\IDES.EXE')
FileCopy('%TEMP%\*.IDE', '%SystemDrive%\Sophos~1\', 1)
RunWait('NET STOP SWEEPSRV.SYS', '', @SW_HIDE)
RunWait('NET START SWEEPSRV.SYS', '', @SW_HIDE)
FileDelete('%TEMP%\*.IDE')
FileDelete('%TEMP%\IDES.EXE')

Sutefan

Edited by sutefan

これは私の署名であり, 私の名前はsutefan である !

Share this post


Link to post
Share on other sites

I'm roughly guesing here but you will most likely have to set those up as variables.

if FileExists("c:\windows\temp") then $temp = "c:\windows\temp"
   RunWait($temp & '\IDES.EXE')

I'm really guessing here and have not tested the code at all.

Share this post


Link to post
Share on other sites

Hi,

Sophos also provides RUS Remote Update Service.......

for use with remote users. Works perfectly....

Andre


What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...