如何在 VB6 中不打开 CMD 窗口运行 shell 命令 [英] How to run a shell command without opening a CMD window in VB6

查看:33
本文介绍了如何在 VB6 中不打开 CMD 窗口运行 shell 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码来自我的 VB6 程序

the following code is part from my VB6 program

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

I used shell command in the VB in order to execute the pscp.exe with the flags and arguments

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

my problem is , when VB run the line:

      Shell strCommand, 1  

它还会打开 CMD 窗口 2-4 秒(CMD 弹出窗口)

its also open the CMD window for 2-4 seconds (CMD popup window)

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

my question - is it possible to run the "Shell strCommand, 1" in way that CMD window will not opened?

我的意思是 - 我不想在运行 VB 应用程序时看到任何 CMD 弹出窗口

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  

推荐答案

可以使用隐藏焦点:

Shell strCommand, vbHide

Shell strCommand, 0

查看其他焦点类型这里http://msdn.microsoft.com/en-us/library/aa242087%28v=VS.60%29.aspx(感谢 MarkJ 提供链接)

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屋!

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