批处理,我可以从批处理脚本中打开网址吗?

时间:2015-05-09 16:40:14

标签: file batch-file search

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

@echo off

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

Set /p question=

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

2 个答案:

答案 0 :(得分:2)

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

此代码段将检查您的问题变量是否包含“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:=%")

答案 1 :(得分:0)

试试这个

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.)