下面的代码是我的VB6程序的一部分
我在VB中使用shell命令来执行带有标志和参数的pscp.exe
我的问题是,当VB运行该行:
Shell strCommand, 1
它也打开CMD窗口2-4秒(CMDpopup窗口)
我的问题 – 是否有可能运行“Shell strCommand,1”的方式,CMD窗口将无法打开?
我的意思是 – 当我运行VB应用程序时,我不想看到任何CMDpopup窗口
Const cstrSftp As String = "D:\pscp.exe" Dim strCommand As String Dim pUser As String Dim pPass As String Dim pHost As String Dim pFile As String Dim pRemotePath As String pUser = "root" pPass = "pass123" pHost = "110.218.201.15" pFile = """D:\scan_ip.ksh""" pRemotePath = "/var/tmp" strCommand = cstrSftp & " -sftp -l " & pUser & " -pw " & pPass & " " & pHost & ":" & pRemotePath & " " & pFile Shell strCommand, 1
你可以使用隐藏焦点:
Shell strCommand, vbHide
要么
Shell strCommand, 0
对于其他焦点类型看这里或http://msdn.microsoft.com/en-us/library/aa242087%28v=VS.60%29.aspx (感谢MarkJ的链接)