The following snippet runs hello.ps located in the folder of the test and redirects PowerShell verbose messages to output.txt.
Global.DoLaunch('cmd.exe /c "powershell.exe -File hello.ps1 *>output.txt"');
Check out the working example on GitHub.
If the script does not work as you expect try to run it manually in cmd.exe and see the output.
You may see something like
File C:\Users\squirrel\Documents\My Rapise Tests\PowerShell\hello.ps1 cannot
be loaded because running scripts is disabled on this system. For more
information, see about_Execution_Policies at
+ CategoryInfo : SecurityError: (:) , ParentContainsErrorRecord
+ FullyQualifiedErrorId : UnauthorizedAccess
To enable Rapise to execute PowerShell scripts you may need to change access permissions. Run the following in PowerShell:
Set-ExecutionPolicy Bypass -Scope CurrentUser
Set-ExecutionPolicy Bypass -Scope LocalMachine
Read more about access rights here.
Note: sometimes you need to run PowerShell scripts in 64-bit mode. To do this use
Global.DoLaunch('%SystemRoot%\\sysnative\\cmd.exe /c "powershell.exe -File hello.ps1 *>output.txt"');
Rapise runs in 32-bit mode, so in order to switch to 64-bit mode we launch cmd.exe from