Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 02-07-2005, 10:18 PM   #1 (permalink)
Addict
 
Location: Texas
Opening URL via batch file

Pulling my hair out here. As part of a batch file, I'd like to open up a browser to a specific webpage. Now, at a command line, for both firefox and ie, you can type "c:\(program directories)\(browser executable) http://www.tfproject.org" and it will open the browser up a ok to the page. The second I slap it in the batch file, though, the whole thing decides it won't work. I've tried it alone too, in various forms, and it's a no go. From trial and error, it seems like the culprit might be the space between the executable and the url. quotes, no quotes, cd\(directory) then (command), I can't get anything to work. Argh!! Any insight?

ps, this is xp
__________________
" ' Big Mouth.
Remember it took three of you to kill me.
A god, a boy, and, last and least, a hero.' "
Pellaz is offline  
Old 02-07-2005, 11:30 PM   #2 (permalink)
Devils Cabana Boy
 
Dilbert1234567's Avatar
 
Location: Central Coast CA
it is feeding it to explorer when you use the run command, in a batch file it is a bit difrent, call explorer and feed the URL as an argument.


Code:
explorer http:\\www.google.com
__________________
Donate Blood!

"Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen
Dilbert1234567 is offline  
Old 02-07-2005, 11:44 PM   #3 (permalink)
Mine is an evil laugh
 
spindles's Avatar
 
Location: Sydney, Australia
This works in a batch file for me:

"C:\Program Files\Mozilla Firefox\firefox.exe" "http://www.google.com"

edit: clarity
__________________
who hid my keyboard's PANIC button?
spindles is offline  
Old 02-08-2005, 10:05 AM   #4 (permalink)
Addict
 
Location: Texas
Thanks guys, both options work Going with spindles just cause it matches the rest of the file nicely. You guys rock!

edit: and now I've got one more minor problem with this thing. I can't get the cmd.exe window to close at the end of starting all of the files (it wants to stay open until I CLOSE all of the files for some reason). I'm using a really sloppy format that looks like "c:\program"|"c:\program"|etc. I initialy tried having seperate lines, but the batch would pause after each program, waiting for me to close the one it opened before starting the new one.

Probably something easy here, but I haven't touched .bats since dos 6.0 really. And every time I google I'm not getting the answers
__________________
" ' Big Mouth.
Remember it took three of you to kill me.
A god, a boy, and, last and least, a hero.' "

Last edited by Pellaz; 02-08-2005 at 10:17 AM..
Pellaz is offline  
Old 02-08-2005, 06:46 PM   #5 (permalink)
Devils Cabana Boy
 
Dilbert1234567's Avatar
 
Location: Central Coast CA
put a start at teh begining of the line

start explorer "www.google.com"

or the same for the other one
__________________
Donate Blood!

"Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen
Dilbert1234567 is offline  
Old 02-08-2005, 09:00 PM   #6 (permalink)
I am not permanent.
 
glytch's Avatar
 
Location: Tennessee
If you want to keep using your existing structure and just make the batch file close after running the commands, simply but the exit command at the end.
__________________
If you're flammable and have legs, you are never blocking a fire exit. - Mitch Hedberg
glytch is offline  
Old 02-08-2005, 09:10 PM   #7 (permalink)
Addict
 
Location: Texas
Quote:
Originally Posted by glytch
If you want to keep using your existing structure and just make the batch file close after running the commands, simply but the exit command at the end.
That was my initial thought too, but it doesn't seem to work. I've tried exit, |exit, "exit", and |"exit" at the end of the line and as a second line. But still the cursed thing sits on my desktop, mocking me, laughing away.
__________________
" ' Big Mouth.
Remember it took three of you to kill me.
A god, a boy, and, last and least, a hero.' "
Pellaz is offline  
Old 02-08-2005, 11:08 PM   #8 (permalink)
Devils Cabana Boy
 
Dilbert1234567's Avatar
 
Location: Central Coast CA
did you try leading the line with 'start' ?
__________________
Donate Blood!

"Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen
Dilbert1234567 is offline  
Old 02-09-2005, 08:58 AM   #9 (permalink)
Addict
 
Location: Texas
Yup, in ever case, leading with start seemed to have no bearing on the batches behavior.
__________________
" ' Big Mouth.
Remember it took three of you to kill me.
A god, a boy, and, last and least, a hero.' "
Pellaz is offline  
Old 02-09-2005, 09:01 AM   #10 (permalink)
Devils Cabana Boy
 
Dilbert1234567's Avatar
 
Location: Central Coast CA
start is designed to open the command in a new window, so that the original cna close when it finishes. can i see your code.
__________________
Donate Blood!

"Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen
Dilbert1234567 is offline  
Old 02-09-2005, 09:21 AM   #11 (permalink)
Addict
 
Location: Texas
Due to NDA stuff and the fact that I know some members of TFP definately fall under it's protection, I can't list the exact code, but this is the gist of it:

Code:
"c:\Program Files\PROGRAM" "C:\Program Files\REFERNCE FILE TO OPEN IN PROGRAM"|"c:\Program Files\PROGRAM"|"c:\Program Files\PROGRAM"|"c:\Program Files\Mozilla Firefox\firefox.exe" "http://URL"
That works just fine in getting the job done. If I parse it with start| and |exit , it runs as normal, then opens up a new cmd.exe window at the end for the directory where the batch file is, leaving me with two of the things staring defiantely at me.

Sorry if I'm being incredibly obtuse here

edit: It's just the start| that causes the new window to open. The |exit on the end shows no change if it's there or not, regardless of if start| is at the begining.
__________________
" ' Big Mouth.
Remember it took three of you to kill me.
A god, a boy, and, last and least, a hero.' "

Last edited by Pellaz; 02-09-2005 at 09:25 AM..
Pellaz is offline  
Old 02-09-2005, 02:43 PM   #12 (permalink)
Devils Cabana Boy
 
Dilbert1234567's Avatar
 
Location: Central Coast CA
why do you referance firefox? if it is the default browser it should use it. besides that

let me try and understand what you want.

1st you want to open a file in a program, then you want to open a URL in browser

here we go:

Code:

start %SystemRoot%\system32\notepad.exe c:\1.txt
start explorer http:\\google.com
no exit at all, you dont need it, you only need exit if you want to end the batch file befor it reaches the last line of code.

i have no clue why you have so many Pipes "|" in your code either.
__________________
Donate Blood!

"Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen
Dilbert1234567 is offline  
Old 02-09-2005, 03:18 PM   #13 (permalink)
Addict
 
Location: Texas
Thanks for your patience and help Dilbert, I appreciate it.

The pipes are there because the information I was able to find on my own suggested that as a way to start multiple processes via a batch. The sample with the pipes in it does everything I want to a T except closing the cmd.exe window, and every other method I tried I couldn't get to work even that well.

As per your suggestion, I tried this one:
Code:
start "path1.exe" "file"
start "c:\Path2.exe"
start "c:\Path3.exe"
start explorer URL
This only comes up partialy functional for me. Lines 1 and 4 go off just like they should. The initial cmd window closes as I'd like with this one. But now, lines 2 and 3 don't actualy start the programs, but rather open up a cmd window titled "c:\path2/3.exe" with a prompt at wherever the batch file is located. I built the second batch by deleting the pipes, inserting the starts and breaks, so I know there aren't any typos in the paths.
__________________
" ' Big Mouth.
Remember it took three of you to kill me.
A god, a boy, and, last and least, a hero.' "
Pellaz is offline  
Old 02-09-2005, 03:26 PM   #14 (permalink)
Mine is an evil laugh
 
spindles's Avatar
 
Location: Sydney, Australia
firefox is my default browser and running "explorer http://www.google.com" opens up IE...

I think his pipes are line breaks in his batch file.
__________________
who hid my keyboard's PANIC button?
spindles is offline  
Old 02-09-2005, 03:55 PM   #15 (permalink)
Devils Cabana Boy
 
Dilbert1234567's Avatar
 
Location: Central Coast CA
I mistyped that, it should be

start http:\\URL

that will start with the default browser.

Ok I think I got it this time. Before you execute the program change the directory to the directory that contains it. It seems like it is finicky with quotes.

Ie

Cd “c:\path to the file\”
Start file.exe
Cd c:\path to other file\”
Start otherfile.exe
__________________
Donate Blood!

"Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen
Dilbert1234567 is offline  
Old 02-09-2005, 04:05 PM   #16 (permalink)
Addict
 
Location: Texas
That's it! Works perfectly now with the cd\ command to the directory then starting the executable.

Thanks ever so much sir.
__________________
" ' Big Mouth.
Remember it took three of you to kill me.
A god, a boy, and, last and least, a hero.' "
Pellaz is offline  
Old 02-09-2005, 04:53 PM   #17 (permalink)
Devils Cabana Boy
 
Dilbert1234567's Avatar
 
Location: Central Coast CA
ahahaha finaly...

well glad i could help.
__________________
Donate Blood!

"Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen
Dilbert1234567 is offline  
 

Tags
batch, file, opening, url


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 12:04 AM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76