使用VBScript(运行O(N)
),如何调用另一个命令程序(在这种情况下为cscript
),这也需要用户输入等?
目的是初始VBScript将收集参数(密码,用户等),然后收集pscp
命令
pscp
可以发出,用户将能够看到pscp命令的输出,并且能够输入(例如,如果他们输入了错误的密码并且需要再次输入它)。
我目前有:
pscp -r -pw password copyFromPath user@host:copyToPath
我提出的用于生成' create the command, that calls pscp from cmd
Dim comSpec : comSpec = objShell.ExpandEnvironmentStrings("%comspec%")
Dim command : command = comspec & " /C " & """" & "pscp -r -pw " & "^""" & (Replace(pscpPassword,"""","\^""")) & "^"" " _
& "^""" & (windowsPath) & "^"" " _
& pscpUser & "@" & pscpHostName & ":" & Replace(linuxPath," ","\ ") & """"
Dim objExec : Set objExec = objShell.Exec(command)
的替代方案是:
command
但这些都不允许我在调用后与Dim command : command = "pscp -r -pw " & Chr(34) & Replace(pscpPassword,"""","\""") & Chr(34) & " " _
& Chr(34) & windowsPath & Chr(34) & " " _
& pscpUser & "@" & pscpHostName & ":" & Replace(linuxPath," ","\ ")
互动。
修改
我正在呼叫pscp
的事实几乎无关紧要。我可以调用任何要求用户输入并向pscp
和stdout
显示内容的程序
答案 0 :(得分:0)
我将所有命令放在一个脚本中(用&分隔),然后在循环后全部运行它们。我附加“& pause”以保持窗口打开(有关详细信息,请参阅问题评论)