How to Create a Web-opener in Batch

86223

Intro: How to Create a Web-opener in Batch

Before creating a web-opener lets go through a simple code tutorial..

1>(echo) code "echo" are used to write a text for e.g " echo Welcome to Instructables".
2>(color 30)code "color" are used to give color to background and font.
3>(set /p =)code "set /p" is used to create console in program.
4>(title)code "title" is used to give title to program 
5>(start)code "start" is used to start a external file.
6>(pause)code "pause" is used to pause a program to avoid, crash. 

Here's the code
<---------------------------------------------------------------------------------

@echo off
title Web opener
color 30
:main
echo.
echo Type url (www.example.com)
echo.
set /p url=www.
echo.
start http://www.%url%/
echo.
echo Web history: %url% was opened..
pause
cls
goto main

-------------------------------------------------------------------------------->

Explanation
1>The code "set /p url" is used to create a console in program and got value can be showed by "%url%".
2>When user types url and presses enter, then that value is forwarded to the code "start" and got value is showed by "%url%".
3> In the same way "echo Web history: %url% was opened.." can be showed..

Please leave a COMMENT..

STEP 1: Extraa

You can add the color codes..

this are some of color codes
Sets the default console foreground and background colors.

COLOR [attr]

  attr        Specifies color attribute of console output

Color attributes are specified by TWO hex digits -- the first
corresponds to the background; the second the foreground.  Each digit
can be any of the following values:

    0 = Black       8 = Gray
    1 = Blue        9 = Light Blue
    2 = Green       A = Light Green
    3 = Aqua        B = Light Aqua
    4 = Red         C = Light Red
    5 = Purple      D = Light Purple
    6 = Yellow      E = Light Yellow
    7 = White       F = Bright White

3 Comments

Hello again code source, I have decided to check out your other instructables just to have something to do.

Firstly, you're sort of cheating the viewers here. You aren't creating CMD, you are simply starting it with a different title. Although clever, you should probably change your title.

Secondly, I am shocked by how much grammar and spelling mistakes I have found. Please proof-read your instructables beforehand.

Thirdly, this code, when run, will spam you with CMD windows and eventually cause your computer to crash. Please fix this with a pause or exit command.

Lastly, I hope this has not been too harsh as I would hate for it to ruin our friendship. Good luck on future projects.
Thanks for your comment, I have changed the topic and improved it. Plz check is it correct or not.

And you can comment on my posts frankly, From now I will try to improve my English..

And again thanks for your advice..
O.K., I have looked at your code again and ...Wait a sec! Does anyone else see that other comment that I made that looks exactly like my other one? Hmmm... Very peculiar.

Anyway, you have an error in your code. In the line "set /p url=" there is an error as you forgot the space between the "set" and the "/p".

Other than that I can't see anything that would phase anyone.

P.S. Ignore that comment below mine as I don't know how it got there.