我会告诉你我有什么,然后尝试解释这个问题,
@echo off
Echo put search in front of a question to search for the answer on the internet
Set /p question=
到目前为止,如果用户将搜索I放在搜索互联网的问题的前面,我希望它也在一个批处理文件中。谢谢
答案 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=%*"
帮助完整链接
Start a program, command or batch script (opens in a new window.)