Forum Discussion

TestQA1's avatar
TestQA1
Frequent Contributor
4 years ago
Solved

Executing powershell file from Test Complete script

Hi Everyone,

I have a PickupTest.ps1 which triggers the software to launch. C:\_Test\abc\AutomatedScripts\My Tests\PickupTest.ps1

The below line of code sometimes works but most times the Powershell seems to open but the software does not launch. The problem seems to be the space in My Test in the path which I unfortunately cannot change at the moment.  

WshShell.Run("powershell -file \"" + pathvar + "\\My Tests\\PickupTest.ps1")

The other alternative someone suggested was to create a temporary drive and pick up the file from there to avoid space issue, but it also does not seem to be working all the time.

WshShell.Run("powershell -file B:\PickupTest.ps1");

 

Can anyone help me deal with the space in the path when running powershell please?

 

Thanks in advance.