如何使用PowerShell启动网页

时间:2017-03-02 19:25:13

标签: powershell

另一部分剧本的一部分。

如果用户选择“是”,我只想让脚本关闭 如果他们没有,那么我想提示另一个问题然后询问他们是否想要打开一个URL。

 $url = $wshell.Run("http://www.google.com")
 $a = new-object -comobject wscript.shell 
 $intAnswer = $a.popup("Did this fix the issue with Citrix/VDI?", 0,"Issue  fixed",4) 
 If ($intAnswer -eq 6) 
{ 
$a.popup("You answered yes.") 
} 
else 
{ 
$a.popup("You answered no.")
} 

修改

$a = new-object -comobject wscript.shell 
$intAnswer = $a.popup("Did this fix the issue with Citrix/VDI?", 0,"Issue fixed",4) 
  If ($intAnswer -eq 6) 
  { 
$a.popup("You answered yes.")
} 
else 
{ 
$intAnswer2 = $a.popup("Do something else", 0,"Issue fixed",4)
} 

我拥有它

$a = new-object -comobject wscript.shell 
$intAnswer = $a.popup("Did this fix the issue with Citrix/VDI?", 0,"Issue fixed",4) 
If ($intAnswer -eq 6) 
{ 
$a.popup("You answered yes.")
} 
else 
{ 
#$a.popup("You answered no.")
$intAnswer2 = $a.popup("Would you like", 0,"Maybe Chat",4)
if ($intAnswer2 -eq 6)
    {
     $IE=new-object -com internetexplorer.application
     $IE.navigate2("https://www.google.com")
     $IE.visible=$true 
    }
}     

1 个答案:

答案 0 :(得分:-1)

 $a = new-object -comobject wscript.shell 
 $intAnswer = $a.popup("Did this fix the issue with Citrix/VDI?", 0,"Issue  fixed",4) 
 If ($intAnswer -eq 6) 
 { 
 $a.popup("You answered yes.")
 } 
 else 
 { 
 #$a.popup("You answered no.")
 $intAnswer2 = $a.popup("Would you like", 0,"Maybe Chat",4)
 if ($intAnswer2 -eq 6)
{
 $IE=new-object -com internetexplorer.application
 $IE.navigate2("https://www.google.com")
 $IE.visible=$true 
}
}