【问题标题】:Batch, Can I open a url from a batch script?批处理,我可以从批处理脚本中打开一个网址吗?
【发布时间】:2015-07-20 11:19:28
【问题描述】:

我会告诉你我有什么然后尝试解释这个问题,

@echo off

Echo put search in front of a question to search for the answer on the internet

Set /p question=

到目前为止,如果用户将搜索 I 放在搜索 Internet 的问题前面,我希望它也包含在一个批处理文件中。谢谢

【问题讨论】:

标签: file batch-file search


【解决方案1】:

试试这个

cd C:\Program Files\Internet Explorer
iexplore http://www.google.pt/search?q=%search%+site:https://stackoverflow.com/

或简单

START "" "http://www.google.com/search?q=%*"

也看看这个POST和这个POST

帮助完整链接

Batch File Commands

Start a program, command or batch script (opens in a new window.)

【讨论】:

    【解决方案2】:

    如果你只是想打开默认的网络浏览器,就像使用start一样简单。

    此 sn-p 将通过替换“search:”并与原始变量进行比较来检查您的问题变量是否包含“search:”。如果它们匹配,则未输入搜索。

    @setlocal enableextensions enabledelayedexpansion
    
    set /p question=
    set questionWOspaces=%question: =+%
    IF NOT "%question:search:=%"=="%question%" (START http://www.google.com/search?q="%questionWOspaces:search:=%")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-09
      • 1970-01-01
      • 2011-06-15
      • 1970-01-01
      • 2015-11-01
      • 1970-01-01
      • 2014-12-03
      • 1970-01-01
      相关资源
      最近更新 更多