powershell - 使用脚本搜索谷歌

标签 powershell

我是 Powershell 的新手,在有了一些想法并决定稍微修改后,我注意到我可以在 Poswershell 中编写一个脚本,它将在我指定的搜索引擎上发出搜索请求。

问题是我不确定它到底是如何工作的。当我所做的只是指定一个包含地址的字符串时,这个脚本如何知道如何打开我的网络浏览器?

我搜索了其他帖子,但没有找到任何接近我所问的内容(我相信)。 这是我的来源,我还会添加一张图片。

[String]$SearchFor = "bing rewards"

$Query = "http://www.bing.com/search?q=$SearchFor"

Start $Query

enter image description here

谢谢大家的帮助。

最佳答案

阅读启动过程的帮助

https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.management/start-process

If you specify a non-executable file, Start-Process starts the program that is associated with the file, similar to the Invoke-Item cmdlet.

所以如果我在 C:\test.txt 中有一个 TXT 文件并运行

start-process c:\test.txt

它将打开与该文件关联的我的默认应用程序。在我的电脑上,它会在记事本中打开 test.txt。

希望现在已经清楚了。

关于powershell - 使用脚本搜索谷歌,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44054612/

相关文章:

powershell - PowerShell 中 "| foreach { "$ _"}"的别名

powershell 输出中的 HTML 表

使用 .NET ZipFile.CreateFromDirectory 时,Powershell 脚本使用用户的主目录作为当前工作目录。怎么修?

arrays - 如何将 AD 计算机名称传递给数组?

powershell - Powershell有时输出目录路径的方式有所不同

windows - 如何使用windows cmd查看用户权限?

Powershell检查变量是否为对象

.net - PowerShell:System.Net.WebClient.DownloadFile 不会下载从 ListDirectory 收集的文件

visual-studio - 有人找到了适用于 Visual Studio 的 PowerShell 语法突出显示或 IntelliSense 插件吗?

powershell - 是否可以使用 Powershell 单击应用程序中的按钮?