0
當我嘗試從.bat文件調用下面的power shell函數時,它甚至不執行。在這裏我的函數需要三個參數。 我嘗試從bat文件下面的腳本。他們都沒有工作。 任何人都可以引導我在哪裏我犯了錯誤,請緊急需要。從.bat文件調用Power shell函數
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,
)