How to get input in batch file??
-
i need to open website in cmd when i type start www.google.com its opening google in browser. But i need like this. For ex: If i get input as google it should make command start www.google.com If i get input as yahoo it should make command start www.yahoo.com What code i need to write on batch file
-
Answer:
You can do that in two different ways. The first one is to append www. and .com to wichever the program get as input with SET /P command. For example: set /p name=Enter the command you wish: start www.%name%.com If you want to run just certain programs, it is easier to show a menu and read just a digit to select an option. For example: :menu cls echo 1- Google echo 2- Yahoo! echo 9- exit :getoption echo/ set /p option=Enter the option you wish: for %%o in (1 2 9) do if "%option%" == "%%o" goto option-%%o echo Invalid option, repeat goto getoption :option-1 start www.google.com goto menu :option-2 start www.yahoo.com goto menu :option-9
George at Yahoo! Answers Visit the source
Other answers
Set /p Input=Enter website name (no www or .com, just the name)-- Start www.%Input%.com This doesn't do any error checking
The Outcaste
you would have command line parameters. in the file, they are referenced by %0, %1, %2, etc. with %0 referencing the name of the file you called, and %1 on representing any parameters.
Auxiliary
You can't open a website in a command window. Websites must be opened in something that can interpret HTML coding; i.e., a browser. The best you can hope for is to transfer files to your computer in a command window using FTP, but you have to know the location of the files you want to download.
Chris G
Related Q & A:
- How To Get File Server Free?Best solution by engadget.com
- How to get the album art of mp3 file?Best solution by Stack Overflow
- How to run an interactive batch file on windows from a service?Best solution by Stack Overflow
- How to get the First frame from Video file?Best solution by Stack Overflow
- How to make a batch file copy itself?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.