Jump to content
Sign in to follow this  
p3t3r

RunWait() With more than one Variable

Recommended Posts

p3t3r

Hello,

I've searched a lot of tutorials, but didn't find the solution. Hope someone here can help me.

I want to start a command-line virus-scanner and scan a drive. When I invoke the scanner, I have to pass

some args. The driveletter can change, so I have to find out the correct one first and store it in a variable.

$drive ist the drive I want to scan.

In the commandline, I have to pass this driveletter several times but I can't get it right

The code looks like this, but it doesn't work. There must be something wrong with quotationmarks, i guess.

$Return=RunWait(& $drive"tools\ClamWin\bin\clamscan.exe --database="& $drive"tools\ClamWin\dbs\db --skip-noexe" & $drive)

Share this post


Link to post
Share on other sites
weaponx

How are you assigning $drive?

Like this: $drive = "C:\"

- or -

$drive = "C:"

$Return = RunWait($drive & "tools\ClamWin\bin\clamscan.exe --database=" & $drive & "tools\ClamWin\dbs\db --skip-noexe " & $drive)

Edited by weaponx

Share this post


Link to post
Share on other sites
martin

Hello,

I've searched a lot of tutorials, but didn't find the solution. Hope someone here can help me.

I want to start a command-line virus-scanner and scan a drive. When I invoke the scanner, I have to pass

some args. The driveletter can change, so I have to find out the correct one first and store it in a variable.

$drive ist the drive I want to scan.

In the commandline, I have to pass this driveletter several times but I can't get it right

The code looks like this, but it doesn't work. There must be something wrong with quotationmarks, i guess.

$Return=RunWait(& $drive"tools\ClamWin\bin\clamscan.exe --database="& $drive"tools\ClamWin\dbs\db --skip-noexe" & $drive)

This might be it; I find this tricky myself. I wasn't sure if you meant to have the minus signs twice each time so you might need to correct what I've done.

;$drive = 'C'

$Return=RunWait('"' & $drive & ':\tools\ClamWin\bin\clamscan.exe"' & ' "-database=' & $drive & ':\tools\ClamWin\dbs\db -skip-noexe ' & $drive & "')


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
p3t3r

Thank You!

weaponx, it's like this:

Everything is on a USB-Sitck. the Stick gets inserted, the Script will be evoked by the autorun -Statement in "autorun.inf".

Now, before a certain application on the stick is started, the whole Stick should be checked by the Virus-Scanner. The Scanner

resides on the stick, too.

And because the driveletter of the stick can be another one on different systems, I have to find out the driveletter, first.

After that, start the scanner and pass the driveletter as an argument more than one time.

Ok, now I try martin's syntax and post the result, soon.

Here's the code:

$dir = @WorkingDir

$drive = StringLeft($dir, 3)

Might also look like: $drive = StringLeft(@WorkingDir, 3) -but I don't use that one

Edited by p3t3r

Share this post


Link to post
Share on other sites
p3t3r

Hello,

whatever combinations of quotationmarks I use, I always get an error.

In this exemple, it interprets the variable a a string. :P

G:\tools\gon.au3 (17) : ==> Error in expression.:

$Return=RunWait('"'& $drive''"tools\ClamWin\bin\clamscan.exe --database="''& $drive''"tools\ClamWin\dbs\db --skip-noexe "'''& $drive''"')

$Return=RunWait(^ ERROR

Like this, it works:

$Return=RunWait(& $drive"tools\ClamWin\bin\clamscan.exe --database=g:\tools\ClamWin\dbs\db --skip-noexe g:\")

But the problem is: how can I use the variable two more times in the string? (g:\ in this case)

Thanks to everyone in advance!

Share this post


Link to post
Share on other sites
weaponx

You can use single quotes within double quotes.

$Return = RunWait($drive & "tools\ClamWin\bin\clamscan.exe --database='" & $drive & "tools\ClamWin\dbs\db' --skip-noexe " & $drive)

Share this post


Link to post
Share on other sites
p3t3r

Thanks again, but it didn't work.

I got it working like this, now:

;First, put the whole Argument in ONE variable.

$clam_arg=$drive & "tools\ClamWin\bin\clamscan.exe --database=" & $drive & "tools\ClamWin\dbs\db --skip-noexe " & $drive

;And then, call the Virus-Scanner with that variable:

$Return = RunWait($clam_arg)

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  

×