Batch file to search wikipedia

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Vysvader
Posts: 1
Joined: 05 Feb 2014 10:12

Batch file to search wikipedia

#1 Post by Vysvader » 05 Feb 2014 10:28

After a lot of hours of Google search I think that really need your help, because I just learn Batch. I make commands for a .bat file similar .cmd, an improved personal assistent with simplier command of human language and one of his functions would be a websearch on Wikipedia. But now... I've problem to make something like this:

Code:
:what is 'empty area to fill here'
start chrome.exe http://en.wikipedia.org/wiki/'filled area here'
goto start
E.g.: ':what is 'Adam'' would be a command writting into command line of my open source program because of cmd.exe will open chrome.exe on url: http://en.wikipedia.org/wiki/Adam

Thanks for any usable advise

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: Pls, help me to create one Batch command

#2 Post by carlos » 05 Feb 2014 13:46

try this:

Code: Select all

@echo off
setlocal enabledelayedexpansion

:in
set "area="
set /P "area=search:"
if not defined area goto :in
start chrome.exe http://en.wikipedia.org/wiki/!area!
goto in

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Pls, help me to create one Batch command

#3 Post by ShadowThief » 05 Feb 2014 13:50

Code: Select all

@echo off
cls

set /p "subject=Enter your subject: "
start chrome.exe http://en.wikipedia.org/wiki/"%subject%"

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Pls, help me to create one Batch command

#4 Post by foxidrive » 05 Feb 2014 17:58

This presents a search term to the wikipedia search engine:

Code: Select all

@echo off
cls
:loop
set "subject="
set /p "subject=Enter your subject: "
if not defined subject goto :EOF
set "subject=%subject: =+%"
start "" chrome.exe "http://en.wikipedia.org/w/index.php?search=%subject%"
goto :loop

Post Reply