p3t3r Posted November 22, 2007 Share Posted November 22, 2007 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) Link to comment Share on other sites More sharing options...
weaponx Posted November 22, 2007 Share Posted November 22, 2007 (edited) 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 November 22, 2007 by weaponx Link to comment Share on other sites More sharing options...
martin Posted November 22, 2007 Share Posted November 22, 2007 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 passsome 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 rightThe 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. Link to comment Share on other sites More sharing options...
p3t3r Posted November 22, 2007 Author Share Posted November 22, 2007 (edited) 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 November 22, 2007 by p3t3r Link to comment Share on other sites More sharing options...
p3t3r Posted November 22, 2007 Author Share Posted November 22, 2007 Hello,whatever combinations of quotationmarks I use, I always get an error.In this exemple, it interprets the variable a a string. 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(^ ERRORLike 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! Link to comment Share on other sites More sharing options...
weaponx Posted November 23, 2007 Share Posted November 23, 2007 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) Link to comment Share on other sites More sharing options...
p3t3r Posted November 23, 2007 Author Share Posted November 23, 2007 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) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now