Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I was developing a antivirus real-time scanner for clamwin, I uses the filesystemwatcher control in vb.net 2010 express and the shell command, but there is a problem in the shell command, I dont know how to use the shell command in vb.net

the shell command is my problem:
Shell("C:\Program Files\GPMAV\clamscan.exe" & "--infected --bell --no-summary  --remove --kill --scan-mail=yes --tempdir=%temp% --unload    --max-files=500 --max-scansize=150M --max-recursion=50 --max-filesize=100M" & e.FullPath)


I want the shell command to run the clamscan.exe and scan with the e.fullpath and with the clamscan.exe parameters... I need help!

Thanks in advance! :)

here is my code:
Try
    Labellastreal.Text = e.FullPath
    ListBox1.Items.Add(Labellastreal.Text)
    Me.OpenFileDialog1.FileName = ""
    Me.OpenFileDialog1.FileName = e.FullPath
    Shell("C:\Program Files\GPMAV\clamscan.exe" & "--infected --bell --no-summary  --remove --kill --scan-mail=yes --tempdir=%temp% --unload    --max-files=500 --max-scansize=150M --max-recursion=50 --max-filesize=100M" & e.FullPath)
    'Dim ProcID As Integer
    ' Run Calculator.
    'ProcID = Shell("C:\Program Files\GPMAV\clamscan.exe" & "--infected --bell --no-summary  --remove --kill --scan-mail=yes --tempdir=%temp% --unload    --max-files=500 --max-scansize=150M --max-recursion=50 --max-filesize=100M" & e.FullPath, AppWinStyle.NormalFocus)
    'Shell("C:\Windows\system32\calc.exe", AppWinStyle.NormalFocus)

[edit]Subject and tags only - OriginalGriff[/edit]
Posted
Updated 11-Apr-11 23:47pm
v3
Comments
Pong D. Panda 12-Apr-11 6:01am    
Your commented code on calc.exe should work. The problem might be on your parameters passed to your clamscan.exe
sora97 12-Apr-11 7:11am    
posted ny hen0va
------------------start--------------
Your commented code on calc.exe should work. The problem might be on your parameters passed to your clamscan.exe
------------------end--------------
the calc.exe parameter works, yeah your right the parameters to clamscan.exe failed...

Shell("""C:\Program Files\GPMAV\clamscan.exe"" " & "--infected --bell --no-summary  --remove --kill --scan-mail=yes --tempdir=%temp% --unload    --max-files=500 --max-scansize=150M --max-recursion=50 --max-filesize=100M " & e.FullPath)


Have enclose filepaths in " and have space after exe name and before e.fullpath, if all other parameters are correct.
Alternatively you can try Process.Start(filename, arguments)
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 12-Apr-11 12:10pm    
Correct answer, my 5, but also see my arguments in favor of Process.
--SA
Espen Harlinn 12-Apr-11 15:36pm    
Nice reply, 5ed!
sora97 12-Apr-11 22:34pm    
tnx :)
Always prefer System.Diagnostic.Process.Start!

It is more portable method with all the features. You can track the status of already running application, access its main window, wait for its completion, terminate it, re-direct its console input or output and a lot more.

—SA
 
Share this answer
 
Comments
Nish Nishant 12-Apr-11 12:12pm    
Voted 5, good response.
Sergey Alexandrovich Kryukov 12-Apr-11 12:39pm    
Thank you, Nishant.
--SA
Espen Harlinn 12-Apr-11 15:37pm    
Good points, my 5
Sergey Alexandrovich Kryukov 12-Apr-11 16:29pm    
Thank you, Espen.
--SA
sora97 12-Apr-11 22:34pm    
thank you! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900