How do I call a Windows shell command using VB6?

前端 未结 6 702
无人及你
无人及你 2020-11-30 10:31

How exactly using VB6 can I can call any Windows shell command as you would from the command-line?

For example, something as trivial as:

echo foo
         


        
6条回答
  •  执念已碎
    2020-11-30 11:24

    a combination of all

    Shell Environ("COMSPEC") & " /c echo foo", vbNormalFocus
    

    you should think in expanding COMSPEC environment variable if you wish to support earlier systems like windows 9x or me.

    You can also obtain the process id using

    pid = Shell(Environ("COMSPEC") & " /c echo foo", vbNormalFocus)
    

提交回复
热议问题