我正在尝试使用这个:
$Properties = @((0,100),(20,200))
$URLS = @(("www.google.com","www.yahoo.com"),("www.bing.com","www.msn.com"))
for ($a=0; $a -le 0; $a++)
{
for ($b=0; $b -le 1; $b++)
{
Start-Job -name ("Job"+$a+$b) -FilePath "C:UsersRobertDesktopVoodooVoodoo-v2JobsNewJob1-1.ps1" -ArgumentList $a,$b,$Properties,$URLS
Start-Sleep -Seconds 1
}
}
要运行此命令:
param $c $d $Prop $U
function OpenBrowserWindow([int]$top,[int]$left)
{
$date = get-date
$Global:ie = new-object -comobject "InternetExplorer.Application"
$ie.visible = $true
$ie.Top = $top
$ie.Left = $left
#$ie.FullScreen = $true
}
function URL($URL1,$URL2)
{
$ie.navigate($URL1)
start-sleep -s 5
$ie.navigate($URL2)
start-sleep -s 5
}
OpenBrowserWindow $Prop[$c][$d] $Prop[$c][1];
do
{
URL $U[$c][$d] $U[$c][1];
}
until ($date.year -ieq 2020)
但我不断得到:
Start-Job : Missing ')' in function parameter list. At C:UsersRobertDesktopVoodooHomerTester22.ps1:9 char:13 + Start-Job <<<< -name ("Job"+$a+$b) -FilePath "C:UsersRobertDesktopVoodooVoodoo-v2JobsNewJob1-1.ps1" -ArgumentList $a,$b,$Properties,$URLS + CategoryInfo : ParserError: (CloseParenToken:TokenId) [Start->Job], ParseException + FullyQualifiedErrorId : MissingEndParenthesisInFunctionParameterList,Microsoft.PowerShell.Commands.StartJobCommand
我已经一遍又一遍地检查了这个东西,但似乎找不到我缺少")"的地方
如果有人能帮助我解决这个问题,我将不胜感激。
错误位于ps1
的第一行。 参数必须括在括号中。
param( $c $d $Prop $U)
function OpenBrowserWindow([int]$top,[int]$left)
{
$date = get-date
$Global:ie = new-object -comobject "InternetExplorer.Application"
$ie.visible = $true
$ie.Top = $top
$ie.Left = $left
#$ie.FullScreen = $true
}
function URL($URL1,$URL2)
{
$ie.navigate($URL1)
start-sleep -s 5
$ie.navigate($URL2)
start-sleep -s 5
}
OpenBrowserWindow $Prop[$c][$d] $Prop[$c][1];
do
{
URL $U[$c][$d] $U[$c][1];
}
until ($date.year -ieq 2020)