0

I'll show you what I have then try to explain the question,

@echo off

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

Set /p question=

That's it so far, if the user puts search I front of a question it searches the Internet, I would like it so it is in one batch file as well. Thanks

Pang
  • 9,564
  • 146
  • 81
  • 122
Billy
  • 11
  • 1
  • 3
  • possible duplicate of [How do you search the Internet with a batch script and a keyword?](http://stackoverflow.com/questions/30135897/how-do-you-search-the-internet-with-a-batch-script-and-a-keyword) – rojo May 10 '15 at 01:15

2 Answers2

2

If you just want to open the default web browser, it's as simple as using start.

This snippet will check to see if your question variable contains "search:" by replacing "search:" and comparing against the original. If they match, search wasn't entered.

@setlocal enableextensions enabledelayedexpansion

set /p question=
set questionWOspaces=%question: =+%
IF NOT "%question:search:=%"=="%question%" (START http://www.google.com/search?q="%questionWOspaces:search:=%")
Chrsjkigs99
  • 850
  • 1
  • 9
  • 18
0

Try this

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

or simple

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

Also look at this POST & this POST

help full links

Batch File Commands

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

Community
  • 1
  • 1
0m3r
  • 12,286
  • 15
  • 35
  • 71