2015-05-09 62 views
0

我会告诉你我已再试图解释的问题,批处理,我可以从批处理脚本中打开url吗?

@echo off 

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

Set /p question= 

就是这样,到目前为止,如果用户将它在网上搜索问题的搜索我的面前,我想它,所以它也在一个批处理文件中。由于

+0

可能重复[如何使用批处理脚本和关键字搜索Internet?](http://stackoverflow.com/questions/30135897/how-do-you-search-the-internet-与-A-批处理脚本和一个关键字) – rojo

回答

1

如果你只是想打开默认的Web浏览器,这是因为使用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:=%")