[英]How to run a shell command without opening a CMD window in VB6
the following code is part from my VB6 program 以下代码是我的VB6程序的一部分
I used shell command in the VB in order to execute the pscp.exe with the flags and arguments 我在VB中使用了shell命令,以执行带有标志和参数的pscp.exe。
my problem is , when VB run the line: 我的问题是,当VB运行该行时:
Shell strCommand, 1
its also open the CMD window for 2-4 seconds (CMD popup window) 它还会打开CMD窗口2-4秒(CMD弹出窗口)
my question - is it possible to run the "Shell strCommand, 1" in way that CMD window will not opened? 我的问题-是否可以以不打开CMD窗口的方式运行“ Shell strCommand,1”?
I mean - I not want to see any CMD popup window when I run VB application 我的意思是-我不希望在运行VB应用程序时看到任何CMD弹出窗口
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
You can use hidden focus: 您可以使用隐藏焦点:
Shell strCommand, vbHide
or 要么
Shell strCommand, 0
For other focus types look Here or http://msdn.microsoft.com/en-us/library/aa242087%28v=VS.60%29.aspx (thanks to MarkJ for the link) 有关其他焦点类型,请参见此处或http://msdn.microsoft.com/zh-cn/library/aa242087%28v=VS.60%29.aspx (感谢MarkJ提供的链接)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.