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 04:09 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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360