TestQA1
2 years agoFrequent Contributor
How to pass parameters in WshShell.Run
Hi all,
I hope you all are doing well.
I use powershell files alot in Javascript test complete scripts.
But I am struggling to pass paramaters in string.
var testingP = "some path";
var source = "some path";
var destination= "des path";
WshShell.Run("powershell -file \"" + testingP + "ABCD.ps1\"" & source & destination);
The powerhsell file executes if I dont add & source & destination but I need to pass parameters.
My PS file:
[CmdletBinding()]
param (
$source,
$destination
)
function copy($source, $destination) {
Copy-Item –Path $source -Destination $destination -Recurse
}
thanks