Sign in to follow this  
Followers 0
Parker

Issues running AutoIt executables from CD

12 posts in this topic

:P

Hi there. I'm working on a project that's not too ambitious, but is a little in-depth. Some backstory:

I work for a PC support company, and most of my job is Antivirus/Antispyware removal. I work with about 10 other technicians, and half of them only run one or two programs and declare the PC's fixed (those PC's almost always come back to be redone), and the other half are new and simply lack tools to do this.

What I'm trying to make is a CD that can be popped into an infected machine and kind of step-by-step does a thorough malware removal. I'm mainly trying to tackle adware, spyware, toolbars and other annoyances, as we use Norton Corporate for virus stuff. The purpose of this is threefold: one, to make sure the best possible job is done the first time; two, to speed up our turnaround time; and third (the result of the first two), improve our reputation with customers ("These guys are great, they got all the viruses and spyware off of my computer and I got my PC back the same/next day!" is something I'd love to hear--our turnaround for that is 3 days, it used to be a week, so wherever we can improve, I want to do).

Programs I'm using in the first iteration of this application are:

-CCleaner

-Ad-Aware

-Spybot S&D

-AVG

-Ewido

-Spysweeper

-MS Antispyware

-Spyware Doctor

-WinASO

-RegSupreme

-Diskeeper Lite

I'm using AutoIt to completely automate the installations of the programs, and where possible the scans they do. This all works fine and dandy when I run the script off of the harddrive of the pc I'm coding it on, but as soon as I pop it on a CD and try to run it on any other computer from the CD, the AutoIt executables seem unable to find the install files for the programs.

Because the computers we work on are all sorts of different configurations, I don't want to hardcode a drive path because F:\ might be my CD drive here at home, but the PC's we have at work have F:\ as another hdd, and some of the client PC's we work on only have A, C, and D.

Is there something I'm doing wrong? Is there some way I can code in AutoIt script to ensure 100% of the time that the scripts will find the exe's they're supposed to run? FYI, I'm not the best with scripting or coding, so I'm looking for the simplest solution possible.

To install from the CD, I use this:

Run("ccsetup126.exe")

etc.

To then run the file off of the harddrive, I use:

Run("C:\Program Files\CCleaner\ccleaner.exe")

etc.

(Those are the points where I get errors when running from the CD)

Since I'm loading the AutoIt executables using a batch file, do you think I should try converting the paths in the AutoIt scripts to 8.3-character? For example:

Run("C:\Progra~1\CCleaner\ccleaner.exe")

I think I may have tried this and it didn't work, but the last time I took a look at my code was 4am so I'm not certain I did it right.

Any assistance you can give me would be greatly appreciated. Hopefully this isn't *too* dumb, or *too* complicated.

Share this post


Link to post
Share on other sites



This should work for you. You could just tag the other programs below it in a similar method.

; Silent install Crap Cleaner.

RunWait(@ScriptDir & "\ccsetup126.exe /S")


; Change working dir and run Crap Cleaner with auto clean,
; then working dir back to script dir again.

If FileChangeDir(@ProgramFilesDir & "\CCleaner") Then
    RunWait("ccleaner.exe /auto")
    FileChangeDir(@ScriptDir)
EndIf

:P

Share this post


Link to post
Share on other sites

I just read through some older, seemingly related posts and have come to the conclusion that I need to add single quotes, and the working directory.

My typical code looks like below...

From CD:

Run('"ccsetup126.exe", "CCleaner", "@SW_MAXIMIZE"')

From C:

Run('"C:\Program Files\CCleaner\ccleaner.exe", "C:\Program Files\CCleaner\", "@SW_MAXIMIZE"')

I haven't had problems running this from CD on my coding PC, or my slave (which did have problems before). However, if this doesn't work on the PC's at work later, I'm stuck. I'll let you guys know whether or not this works tonight.

Again, if anyone has any suggestions, I'd appreciate them.

Share this post


Link to post
Share on other sites

Use the @ScriptDir macro to determine the path of the script being run. This will be the same drive as the setup program that you are trying to run. In this way, it will not mater what the CD drive letter is. i.e.

Run( @ScriptDir & "\Setups\ccsetup126.exe")

Also if a program installs by default to the 'Program Files' folder, which can a drive other than C, then use the @ProgramFilesDir macro to determine the path. If the installation program allows you to enter a path, then you can use AutoIt to set it to whatever you want, as you will be removing it later. i.e.

Run(@ProgramFilesDir & "\CCleaner\ccleaner.exe")

I would suggest that you try the programs on computers with different configurations to make sure that it works under every scenario.

Have you looked at seeing if some of the programs run portable? Here a couple of websites with software that will do so. http://www.portablefreeware.com, http://www.usbapps.com and http://portableapps.com. The beauty of a porable app is that there is no install. You could run them directly from the CD. If the programs you have are not on that site, then try and make them portable yourself. Easy way is to install, copy the files somewhere else, uninstall, try and run the program from where you copied it. If it works, great, is it does not, then out of luck.

Good luck.


“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites

Stumpii and MHz, thanks for the pointers. I will try those ideas as well, and see which one works the most and the best.

Thank god for CDRWs.

Share this post


Link to post
Share on other sites

Does @SCRIPTDIR know where the script is and automatically plonk it in, or does it only know the drive?

Let's say my script is here:

D:\Threat Removal\CCleaner\install_ccleaner.exe

Does @SCRIPTDIR plonk in D:\Threat Removal\CCleaner; or does it just know that it's D:\ (or E:\ or G:\ or whatever) and I have to fill in the rest of the path like so?

RUN(@SCRIPTDIR & "\Threat Removal\CCleaner\ccleaner.exe")

or can I just put in

RUN(@SCRIPTDIR & "\ccleaner.exe")

?

Thanks again.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I'm surprised HijackThis isn't listed.

If I recall correctly, you can use /s switch with Ad-Aware and /silent with Spybot to easily install....

You might also want to look at BartPE if you haven't already. (Bootable CD that can load the computer's registry and let you run Ad-Aware, etc....)

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

I'm surprised HijackThis isn't listed.

If I recall correctly, you can use /s switch with Ad-Aware and /silent with Spybot to easily install....

You might also want to look at BartPE if you haven't already. (Bootable CD that can load the computer's registry and let you run Ad-Aware, etc....)

I'll play with the switches for Ad-Aware and Spybot, thanks.

HijackThis is really a bit too powerful for most of our techs, honestly. I use it myself but there's no way I'd let some fresh-out-of-high-school-trying-to-get-A+-certified kid run it on some CEO's pc.

Share this post


Link to post
Share on other sites

From the AutoIt help file:

@ScriptDir - Directory containing the running script. (Result does not contain a trailing backslash).

I think you have the script dir and the program setup dir confused. The easiest way to go is to have the AutoIt script in the root of the CD and the programs to be installed in some subdirectories, say called 'setups'. That way @ScriptDir would return just the drive letter and you could add the setup folder name to it to run the program:

Run( @ScriptDir & "\Setups\Threat Removal\CCleaner\ccsetup126.exe")

If you have the script in a folder 'Scripts' then the @ScriptDir will give you x:\Scripts, so then you need to add code to manipulate that path to get the path to the setup program. Either by extracting the drive letter and adding the rest of the "\Setups\Threat Removal\CCleaner\ccsetup126.exe" path, or removing the last folder in the string. I prefer to keep is simple.


“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites

From the AutoIt help file:

@ScriptDir - Directory containing the running script. (Result does not contain a trailing backslash).

I think you have the script dir and the program setup dir confused. The easiest way to go is to have the AutoIt script in the root of the CD and the programs to be installed in some subdirectories, say called 'setups'. That way @ScriptDir would return just the drive letter and you could add the setup folder name to it to run the program:

Run( @ScriptDir & "\Setups\Threat Removal\CCleaner\ccsetup126.exe")

If you have the script in a folder 'Scripts' then the @ScriptDir will give you x:\Scripts, so then you need to add code to manipulate that path to get the path to the setup program. Either by extracting the drive letter and adding the rest of the "\Setups\Threat Removal\CCleaner\ccsetup126.exe" path, or removing the last folder in the string. I prefer to keep is simple.

As I have it right now, for installer scripts, both the script and the file it is to run are in the same directory. The run script is also there. Think this'll work?

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

As I have it right now, for installer scripts, both the script and the file it is to run are in the same directory. The run script is also there. Think this'll work?

That will work. Just use:

Run( @ScriptDir & "\ccsetup126.exe")

I assume that you are using a program to generate the commands for the installatio. 'AutoItMacroGenerator' that comes with SciTe is the program I use to get the bare bones installation script. I don't think that there is an icon for it in the Start menu when SciTe is installed, so I just go to through Explorer.

Edited by Stumpii

“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

That will work. Just use:

Run( @ScriptDir & "\ccsetup126.exe")

I assume that you are using a program to generate the commands for the installatio. 'AutoItMacroGenerator' that comes with SciTe is the program I use to get the bare bones installation script. I don't think that there is an icon for it in the Start menu when SciTe is installed, so I just go to through Explorer.

0_o

Actually I'm just writing down what keyboard commands need to be sent, how many times and in what order, etc., then typing the relevent code into an au3 file. Gives me something to do.

EDIT:

Hahah, just downloaded SciTe and found the app you mentioned. God, that's going to make my life so much easier. Thanks again!

Edited by Parker

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  
Followers 0