SystemUtil.Run in UFT gives me “invalid procedure call or argument”, Why?

≡放荡痞女 提交于 2020-01-07 03:57:07

问题


I'm using SystemUtil.Run (pathName) in UFT, VBScript. But it gives me

invalid procedure call or argument.

I'm sure about pathName, I'm sure about the command, I'm sure about everything. What do you think might be the cause?


回答1:


If you look at the examples here, you'll see that the approved call is

SystemUtil.Run pathName

(passing pathName per reference) instead of

SystemUtil.Run (pathName)

(passing a const copy).

Eric Lippert's essay should help you to understand the use of () in VBScript.

Evidence:

As I don't use UFT, I can only use .NET to demonstrate that the ()/parameter passing mode matters:

>> Set m_oSB = CreateObject("System.Text.StringBuilder")
>> aData = Split("a b c")
>> m_oSB.AppendFormat_4 "{0}-{1}-{2}", (aData)
>> WScript.Echo m_oSB.ToString()
>>
a-b-c
>> m_oSB.AppendFormat_4 "{0}-{1}-{2}", aData
>>
Error Number:       5
Error Description:  Invalid procedure call or argument
>>



回答2:


I have ran into the same issue. I had to write the full path name for the error to go away.

example: SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe", "www.google.com"

I hope this helps you.



来源:https://stackoverflow.com/questions/31455091/systemutil-run-in-uft-gives-me-invalid-procedure-call-or-argument-why

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!