如何在不打开VB6一个CMD窗口中运行shell命令 [英] How to run a shell command without opening a CMD window in VB6
问题描述
以下code是部分从我的VB6程序
我在VB中使用shell命令,以执行与标志和参数的pscp.exe
我的问题是,当VB运行线路:
贝壳strCommand,1
其还打开2-4秒CMD窗口(CMD弹出窗口)
我的问题 - 是否有可能在方式CMD窗口将不会打开运行壳牌strCommand,1
?我的意思是 - 我不希望看到任何CMD弹出窗口,当我运行VB应用程序
常量cstrSftp的String =D:\\ pscp.exe
昏暗strCommand作为字符串
昏暗pUser作为字符串
昏暗pPass作为字符串
昏暗pHost作为字符串
昏暗PFILE作为字符串
昏暗的premotePath作为字符串
pUser =根
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
壳牌strCommand,1
您可以使用隐藏的重点:
贝壳strCommand,vbHide
或
贝壳strCommand,0
对于其他类型的重点看这里
或 http://msdn.microsoft.com/ EN-US /库/ aa242087%28V = VS.60%29.aspx (感谢MarkJ的链接)
the following code is part from my VB6 program
I used shell command in the VB in order to execute the pscp.exe with the flags and arguments
my problem is , when VB run the line:
Shell strCommand, 1
its also open the CMD window for 2-4 seconds (CMD popup window)
my question - is it possible to run the "Shell strCommand, 1" in way that CMD window will not opened?
I mean - I not want to see any CMD popup window when I run VB application
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)
这篇关于如何在不打开VB6一个CMD窗口中运行shell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!