相关疑难解决方法(0)

如何将参数传递给PowerShell脚本?

有一个PowerShell名为的脚本itunesForward.ps1使iTunes快进30秒:

$iTunes = New-Object -ComObject iTunes.Application

if ($iTunes.playerstate -eq 1)
{
  $iTunes.PlayerPosition = $iTunes.PlayerPosition + 30
}
Run Code Online (Sandbox Code Playgroud)

它使用快速行命令执行:

powershell.exe itunesForward.ps1
Run Code Online (Sandbox Code Playgroud)

是否可以从命令行传递参数并将其应用于脚本而不是硬编码的30秒值?

powershell command-line automation itunes argument-passing

408
推荐指数
6
解决办法
61万
查看次数