TestQA1
3 years agoFrequent Contributor
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 Powershel...
- 3 years ago
Hi,
Assume that pathvar contains the 'C:\Project' value:
your line of code
"powershell -file \"" + pathvar + "\\My Tests\\PickupTest.ps1"
will evaluate to
'powershell -file "C:\Project\My Tests\PickupTest.ps1'
which seems to be just incorrect (lack of closing double-quote -- check this in debugger)
Does it help if you change this line of code to this:
WshShell.Run("powershell -file \"" + pathvar + "\\My Tests\\PickupTest.ps1\"")
(note added \" at the end of code line)