Forum Discussion

madhavisri01's avatar
madhavisri01
Contributor
14 years ago

Exec execution error

Hello,



Ia m trying to execute an exe through test complete and I am using the below commands




function test(strpath)

{

var WShell = Sys.OleObject("WScript.Shell");

WShell.Run(strpath);

WShell.Quit;

}

I have tried passing the below  parameters but both are throwing exceptions actual path is C:\Program Files\Masking\VSM80\Utilities\Valer.exe

1.test("C:\\Program Files\\Masking\\VSM80\\Utilities\\Valer.exe")

2.test("cmd /c \"\"C:\\Program Files\\Masking\\VSM80\\Utilities\\Valer.exe")



First command is throwing an error path not found second one doesnot throw exception at the same time doesnot open exe.I am not sure what is the problem.Is it something to do with current directory settings or can we use cd.. c:\ something.Please help me with the code.



Thanks,

Madhavisri


WShell = .OleObject("WScript.Shell"); WShell.Run(strpath); WShell.Quit;}I have tried passing the below  parameters but both are throwing exceptions actual path is C:\Program Files\Masking\VSM80\Utilities\Valer.exe1.test("C:\\Program Files\\Masking\\VSM80\\Utilities\\Valer.exe")2.test("cmd /c \"\"C:\\Program Files\\Masking\\VSM80\\Utilities\\Valer.exe")First command is throwing an error path not found second one doesnot throw exception at the same time doesnot open exe.I am not sure what is the problem.Is it something to do with current directory settings or can we use cd.. c:\ something.Please help me with the code.Thanks,Madhavisri

1 Reply

  • Hi,



    Your path contains spaces. Enclose it in quotes.

    test("\"C:\\Program Files\\Masking\\VSM80\\Utilities\\Valer.exe\"")