我是 Powershell 的新手,在有了一些想法并决定稍微修改后,我注意到我可以在 Poswershell 中编写一个脚本,它将在我指定的搜索引擎上发出搜索请求。
问题是我不确定它到底是如何工作的。当我所做的只是指定一个包含地址的字符串时,这个脚本如何知道如何打开我的网络浏览器?
我搜索了其他帖子,但没有找到任何接近我所问的内容(我相信)。 这是我的来源,我还会添加一张图片。
[String]$SearchFor = "bing rewards"
$Query = "http://www.bing.com/search?q=$SearchFor"
Start $Query
谢谢大家的帮助。
最佳答案
阅读启动过程的帮助
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/