How do you search the Internet with a batch script and a keyword?

孤街浪徒 提交于 2019-12-13 07:58:33

问题


I would like to create a batch file that once you type something in and click enter you go to an search page on the Internet. The thing is, you type in a keyword before what you want to search. So say I wanted to search the mass of a whale or something, into my program I would type "search what is the mass of a whale" so to tell if I want to go on the Internet or not the script reads to see if the word search is in front of the question. If it is, it searches the Internet, if it isn't my program displays "Retype the command" or something. Any help would be great thanks


回答1:


You can do this with a one-liner. Save this as search.bat:

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

Then in a console window, run the command:

search What is the airspeed velocity of an unladen swallow?


来源:https://stackoverflow.com/questions/30135897/how-do-you-search-the-internet-with-a-batch-script-and-a-keyword

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!