如何在vb.net中使用shell命令 [英] How to use the shell command in vb.net

查看:562
本文介绍了如何在vb.net中使用shell命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在为clamwin开发防病毒实时扫描程序,我在vb.net 2010 express和shell命令中使用了filesystemwatcher控件,但是shell命令中存在问题,我不知道如何使用vb.net中的shell命令

shell命令是我的问题:

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)



我希望shell命令运行clamscan.exe并使用e.fullpath和clamscan.exe参数进行扫描...我需要帮助!

提前致谢! :)

这是我的代码:



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]仅主题和标签-OriginalGriff [/edit]


[edit]Subject and tags only - OriginalGriff[/edit]

推荐答案

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)



如果所有其他参数均正确,则将文件路径包含在中",并在exe名称之后和e.fullpath之前保留空格.
另外,您也可以尝试Process.Start(filename, arguments)



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)


始终选择系统.Diagnostic.Process.Start

具有所有功能的便携式方法.您可以跟踪已运行的应用程序的状态,访问其主窗口,等待其完成,终止它,重新定向其控制台输入或输出等等.

—SA
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


这篇关于如何在vb.net中使用shell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆