Forum Discussion
HKosova
SmartBear Alumni (Retired)
In JScript/JavaScript you need to double the backslashes in paths:
Sys.OleObject("WScript.Shell").Run("powershell -file C:\\windows\\system32\\startps.ps1");
Better yet, do not hardcode the "C:\Windows" path and use an environment variable instead:
Sys.OleObject("WScript.Shell").Run("powershell -file %windir%\\system32\\startps.ps1");
Also note that, by default, the WshShell.Run() method returns immediately and does not wait for the command to complete. If you need to wait for the command completion, set the third parameter of the Run() method to true:
Sys.OleObject("WScript.Shell").Run("powershell -file %windir%\\system32\\startps.ps1", 0, true);
v1kSandi3go
8 years agoOccasional Contributor
thanks for your good solution, however after I tried those changes still doesn't really works in my end. I ran my script manually via powershell application It works fine but running the scripts using TestComplete is not really works, its not giving the right output. If you want I can send to you my recorded video privately.
Related Content
Recent Discussions
- 32 minutes agodhundley
- 44 minutes agosimonaferrara
- 5 hours agoAli2