0

I'm trying to make a batch file that allows me to search for something on wikipedia. But instead of using /p and it asks me for input, I want to to automatically search. For example, I would type search Example, and it would search for example on wikipedia. Thank you in advanced. P.S. I do not have any code currently, but to clarify I dont want to use /p %input% in the code.

MagisterTech
  • 107
  • 1
  • 12
  • possible duplicate of [How to pass command line parameters to a batch file?](http://stackoverflow.com/questions/26551/how-to-pass-command-line-parameters-to-a-batch-file) – rojo Feb 25 '15 at 19:09
  • I need an example. That's too complicated. Sorry if It's a duplicate. – MagisterTech Feb 25 '15 at 19:11
  • Save this to a file named `search.bat` and you're done: `@start "" "http://en.wikipedia.org/wiki/Special:Search?search=%*"` – rojo Feb 25 '15 at 19:12
  • I mean I want to type in what to search for in command and it searches for it. The question you lead me to said something about a /u? Can you give me information on that? – MagisterTech Feb 25 '15 at 19:16
  • My previous comment is the solution. If you prefer, I can post it as an answer below? – rojo Feb 25 '15 at 19:30
  • I'm saying I dont want it to take me to the website's search, I want it to be its own search in a way. Like I'd say Search "Example" and it would search for that on the website and take me there. It would also be great if you could post it as an answer. Thanks! – MagisterTech Feb 25 '15 at 19:32

1 Answers1

1

Save this to a file named search.bat and you're done:

@start "" "http://en.wikipedia.org/wiki/Special:Search?search=%*"

The %* means all command-line arguments. So if, on the command line, you enter

search Example

The script launches your default web browser and opens the Wikipedia search page for Example. Wikipedia then redirects you either to the corresponding article or the disambiguation page, whichever is more appropriate according to Wikipedia's algorithms.

If you:

search snow cream

you instantly get taken to the Wikipedia entry for snow cream.

rojo
  • 24,000
  • 5
  • 55
  • 101
  • @MagisterTech If my answer was helpful, please consider marking it as accepted. [See this page](http://meta.stackexchange.com/q/5234/275822) for an explanation of why this is important. – rojo Feb 25 '15 at 23:18