Bir System.Diagnostics.Process başlatma yöntemini çağırmaya çalışıyorum.Nokta işareti yöntemleri çağrılamadı powershell
$process = new-object System.Diagnostics.Process
$config.variables.properties | foreach {
$process.StartInfo.EnvironmentVariables.Set_Item($_.name, $_.value)
}
$process.StartInfo.UseShellExecute = false;
$process.StartInfo.FileName = "C:\Program Files\IIS Express\iisexpress.exe"
$process.StartInfo.Arguments = "/config:$configPath\${name}ApplicationHost.config \site:$name"
$process.Start()
bu anlamsız hatayı alıyorum: Ben kod çalıştırmasına ancak ben tam bu aynı şeyi internette birçok başka örnek gördüm
Exception calling "Start" with "0" argument(s): "The parameter is incorrect"
At C:\Users\critc\Source\run-iisexpress.ps1:67 char:1
+ $started = $process.Start() | Out-Null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : Win32Exception
Bu yöntem 0 parametre aşırı vardır. Ben çağrı powershell gelen parantez damla eğer sonsuz var içinde Infact bilgelik bana sıfır parametre aşırı
Powershell beni avlayan olduğu
OverloadDefinitions
-------------------
bool Start()
gidecekseniz söyler! Başlangıçta bir ProcessStartInfo örneği oluşturarak ve statik Process.Start yöntemine geçmek için çalışıyoruz ve ben
GÜNCELLEME (o with "1" argument(s)
söyledi hariç) çalışır
İşte benim güncellenmiş kodu aynı hatayı başlamıştı edildi.
$process = new-object System.Diagnostics.Process
Get-Member -inputObject $config.variables -memberType Properties | foreach {
$value = $config.variables | select -exp $_.name
$process.StartInfo.EnvironmentVariables.Set_Item($_.name, $value)
}
$process.StartInfo.UseShellExecute = $false
$process.StartInfo.FileName = "C:\Program Files\IIS Express\iisexpress.exe"
$process.StartInfo.Arguments = "/config:`"$configPath\${name}ApplicationHost.config`" /site:$name"
$started = $process.Start()
if ($started) {
$process.WaitForExit()
}
$ process.StartInfo.UseShellExecute = false $ process.StartInfo.UseShellExecute = $ false olmalı, değil ki? –
@DavidBrabant evet, bu benim sorunumun nedeni olmuş gibi görünmüyor doğrudur. – Sam
İlgileniyorsa burada her şey bir gist - https://gist.github.com/worldspawn/ed3e16accbdefaa8ee35 – Sam