• Batch Scripting Help
    11 replies, posted
I'm trying to make a program that launches google chrome and the website you want. But for some reason, it wont open the website. Heres the code: [CODE]@echo off :loop cls echo Welcome! Just type in the websites URL to begin: echo --------------------------------------------------------------------- echo. set /p web=I want to browse: set /p question= %web%? Is this correct? (y/n) if %question%==y goto yes if not %question%==y goto loop :yes cls echo Loading ping localhost -n 1 >null cls echo Loading. ping localhost -n 1 >null cls echo Loading.. ping localhost -n 1 >null cls echo Loading... ping localhost -n 1 >null pause cls echo Website found! What browser do you want to use? echo -------------------------------------------------------------------------- echo. echo i = Internet Explorer (iexplore.exe, Default) echo c = Google Chrome (chrome.exe) echo. set /p browse = if %browse% == c goto c if not %browse%==c goto i :c "%web%" "C:\Program Files\Google\Chrome\Application\chrome.exe" goto loop exit :i "%web%" "C:/Program Files/Internet Explorer/iexplore.exe" goto loop exit[/CODE] So. What I'm trying to do is make the program start chrome.exe and start the website that you desire. I also made it so you dont need the .com /www. tags. So, What error did I make in this script? And how do I fix it. (Post the code to the thread if you can)
Well for one thing, you should allow the user to put ".com." What if the site was a .net or a .org instead? With this, you can only access some sites.
True, But of course, its a batch file. Nothing advanced. I was just practicing and came accross that I cant use a variable after the start command. I found this very annoying, because it would come in handy in many cases. Thats why I posted it here, just to see if im doing it wrong.
Why are you letting the user wait so long? And if you do, atleast show a progress bar.
See what %webpage% is after the set command by echoing it right after set
It just keeps saying "ECHO is ON" So, what I'm thinking, is that the batch file just wont read my variables and I dont know why.
Remove the space between the variable name and equals sign. The space is being included in the variable name. [code]set /p webpage=I want to browse: echo %webpage%[/code] Echos fine.
Wait awhile, I'm updating the script. I gotta leave in a minute so ill have it when i get back. [editline]2nd January 2012[/editline] Ok, I updated the script. Still wont work. Suggestions?
HA! My brother is such a noob at scripting
<snip, stupid>
What's the advantage here if it's more complicated than just opening and clicking a bookmark?
the advantage is knowing the tools you have at your disposal should you ever want to mass-access websites.
Sorry, you need to Log In to post a reply to this thread.