Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
powershell中的组合框。。。如何基于下拉选择进行处理_Powershell_Powershell 2.0_Powershell 3.0_Powershell 4.0 - Fatal编程技术网

powershell中的组合框。。。如何基于下拉选择进行处理

powershell中的组合框。。。如何基于下拉选择进行处理,powershell,powershell-2.0,powershell-3.0,powershell-4.0,Powershell,Powershell 2.0,Powershell 3.0,Powershell 4.0,下面是代码片段,从下拉列表中选择计算机名并输入,它将在文本文件中生成结果,如下所示。组合框选择是否显示错误 `$buttonEnter\u单击={ if ($combobox1.SelectedItem.ToString == "Computer name") { $path = "$([Environment]::GetFolderPath("Desktop"))\information.txt"; gcim Win32_OperatingSystem | fL * | fl

下面是代码片段,从下拉列表中选择计算机名并输入,它将在文本文件中生成结果,如下所示。组合框选择是否显示错误

`$buttonEnter\u单击={

if ($combobox1.SelectedItem.ToString == "Computer name")
{
    $path = "$([Environment]::GetFolderPath("Desktop"))\information.txt";
    gcim Win32_OperatingSystem | fL * | fl > $path; notepad $path;
}
}`试试这样的东西

 $handler_button1_Click=
 {
    if ($combobox1.Text -eq "Computer name")
    {
        $form1.Text = $combobox1.Text;
        $path = "$([Environment]::GetFolderPath("Desktop"))\information.txt";
        gcim Win32_OperatingSystem | fL * | fl > $path; notepad $path;

    }

 }

 $buttonEnter.add_Click($handler_button1_Click)
 $form1.Controls.Add($buttonEnter)

如果($combobox1.SelectedItem.ToString==“计算机名”){$path=“$([Environment]::GetFolderPath(“Desktop”))\information.txt;gcim Win32_OperatingSystem | fL*| fL>$path;记事本$path;},则可能会回答此问题@特别是57需要帮助请检查此Get-WmiObject-Class Win32_Product-Computer$env:COMPUTERNAME |排序对象名称|选择对象名称、显示版本、发布者、安装日期|格式表–自动调整显示版本,发布者字段显示为空。。我正在查找安装在PC中的所有应用程序。用户可以在文本框中输入应用程序名称。如果出现应用程序,则返回成功窗口,否则返回不成功。。下面是snipet Get WMIOObject-Class Win32|u Product |排序对象名称|选择名称|其中{$|u.Name-匹配“$textbox1.text”}$nametSearch=$textbox1.text;获取WmiObject-Class Win32|u产品|排序对象名称|选择名称|其中{$|u.Name-eq“$nametosearch”}谢谢。请检查这个。如果($combobox1.Text-eq“Network Info”){foreach($arrComputer中的计算机){$path=“$([Environment]::GetFolderPath(“Desktop”))\Network Info.txt;$nwINFO=Get wmioobject-ComputerName$Computer Win32\u networkadapter配置|其中对象{$\ IPAddress-ne$null}|选择对象DNSHostName、Description、IPAddress、IpSubnet、DefaultIPGateway、MACAddress、DNSServerSearchOrder | Format Table-AutoSize | fl>$path;notepad$path;}}网络信息不是在文本文件中生成的,我使用了combox选择,这取决于它应该给出的结果