Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 如何在VB6中运行shell命令而不打开CMD窗口_Windows_Vba_Vb6_Batch File - Fatal编程技术网

Windows 如何在VB6中运行shell命令而不打开CMD窗口

Windows 如何在VB6中运行shell命令而不打开CMD窗口,windows,vba,vb6,batch-file,Windows,Vba,Vb6,Batch File,以下代码是我的VB6程序的一部分 我在VB中使用shell命令来执行带有标志和参数的pscp.exe 我的问题是,当VB运行该行时: Shell strCommand, 1 它还可以打开CMD窗口2-4秒(CMD弹出窗口) 我的问题-是否有可能以CMD窗口不会打开的方式运行“Shell strCommand,1” 我的意思是-当我运行VB应用程序时,我不想看到任何CMD弹出窗口 Const cstrSftp As String = "D:\pscp.exe" Dim s

以下代码是我的VB6程序的一部分

我在VB中使用shell命令来执行带有标志和参数的pscp.exe

我的问题是,当VB运行该行时:

      Shell strCommand, 1  
它还可以打开CMD窗口2-4秒(CMD弹出窗口)

我的问题-是否有可能以CMD窗口不会打开的方式运行“Shell strCommand,1”

我的意思是-当我运行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  

您可以使用隐藏焦点:

Shell strCommand, vbHide

对于其他焦点类型,请查看
或者(感谢MarkJ提供的链接)

+1手册中也记录了参数,没有明确说明要显示:)
Shell strCommand, 0