SORU
8 NİSAN 2011, Cuma


Nasıl bir PowerShell komut dosyası için bir değişken geçmek?

Hızlı ileri 30 saniye: iTunes yapar PowerShell senaryo itunesForward.ps1 adında biri vardı

$iTunes = New-Object -ComObject iTunes.Application

if ($iTunes.playerstate -eq 1)
{
  $iTunes.PlayerPosition = $iTunes.PlayerPosition   30
}

Prompt komutu ile çalıştırılır:

powershell.exe itunesForward.ps1

Komut satırından argüman geçmek ve kodlanmış 30 saniye değeri yerine komut uygulandığı için mümkün mü?

CEVAP
8 NİSAN 2011, Cuma


Test edilmemiş:Test:

param([Int32]$step=30) #Must be the first statement in your script

$iTunes = New-Object -ComObject iTunes.Application

if ($iTunes.playerstate -eq 1)
{
  $iTunes.PlayerPosition = $iTunes.PlayerPosition   $step
}

Aramak

powershell.exe itunesForward.ps1 -step 15

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • ::..ηєѕѕ мιχ..::

    ::..ηєѕѕ

    15 Aralık 2006
  • The Computer Chronicles

    The Computer

    7 Kasım 2012
  • thelonelyisland

    thelonelyisl

    23 Aralık 2005