When I try to call below power shell function from .bat file, it's not executing. Here my function needs three parameters. I tried below script from bat file.both of them didn't work. Where have I made a mistake?
powershell ".\Deploy.ps1 Install-Application -msi '.\test-1.0.1.msi'
-InstallPath '.\InstallPath'
-Environment 'Local'"
powershell NoProfile -ExecutionPolicy Bypass -Command ".\Deploy.ps1 Install-Application -msi '.\test-1.0.1.msi'
-InstallPath '.\InstallPath'
-Environment 'Local'"
function Install-Application
{
param(
[Parameter(Position=0,Mandatory=$true,HelpMessage="Msi file should be existing")]
[ValidateScript({Test-Path $_})]
[Alias("msi")]
[string]$File,
[Parameter(Position=1,HelpMessage="Path wherein the resource file will be installed")]
[Alias("path")]
[string]$InstallPath,
[Parameter(Position=2,Mandatory=$true,HelpMessage="Only valid parameters are Local,Dev,Test and Prod")]
[Alias("env")]
[ValidateSet("Local","Dev","Prod","Test")]
[string]$Environment,
)