在 VB 6 的 Shell 命令中传递参数 [英] Passing parameters in Shell command in VB 6
问题描述
我在 VB 6 中有 2 个 EXE.EXE 1 通过 shell 命令调用另一个 EXE2
I have 2 EXEs in VB 6. EXE 1 calls the other EXE2 through shell command
EXE1:Shell(路径名\EXE2,0)
EXE1 : Shell(PathName\EXE2,0)
现在我只想将一个字符串类型变量传递给我希望在该 EXE2 中接收的 EXE2.我怎样才能达到同样的目标?
Now all I want is to pass a string type variable to EXE2 which I wish to receive in that EXE2. How can I achieve the same?
提前致谢
推荐答案
只需将字符串(可能带引号)附加到文件名的末尾:
Simply append the string (possibly quoted) to the end of the filename:
Shell("""PathName.exe"" wibble", vbNormalFocus)
或:
Shell("""PathName.exe"" ""wibble"" ""wibble 2""", vbNormalFocus)
然后可以使用 Command$()
函数在其他应用程序中读取此值,该函数将包含路径名和空格之后的所有内容,包括参数周围的任何引号(例如 "wibble" "wibble 2"
).
This value can then be read in the other application using the Command$()
function which will include everything after the path name and space, including any quotes around the parameters (e.g. "wibble" "wibble 2"
).
这篇关于在 VB 6 的 Shell 命令中传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!