At a dos-box (command line) prompt, I can type
\\path\\firefox.exe
and Fox will start up. I can add, say, a url or a .jpg file name, and that will come up too.
So, is there a similar command-line prompt that will bring up the default browser?
John
At a dos-box (command line) prompt, I can type
\\path\\firefox.exe
and Fox will start up. I can add, say, a url or a .jpg file name, and that will come up too.
So, is there a similar command-line prompt that will bring up the default browser?
John
just type file.htm
and the default htm handler turns up.
You can do that for any filetype.
You can probably write one in P*werbasic that passes the URL to ShellExecute. Should just be a few lines.
Here's what it looks like in one of my C programs:
ShellExecute(0,"open","http://",0,0,0);
Best regards, Spehro Pefhany
Thanks. That seems to work for things like .jpg files, but not for url's.
John
I got an email informing me that
start
launches the default application for , including the default browser if it's a url.
So I can hack my ancient DOS-based inventory control program to add links to part records, to datasheets or mfr web sites or whatever.
John
Well.... on my pc (xp sp2) it does work,however you have to check the default application attatched to said extension, and maybe change it to the one you want, rightclick/properties on htm file and check/change the "opens with" part.
I can
\\path\\Firefox toad.jpg
but I'd rather use Irfanview to view simple, local pics, which is what "start" does on my machine. It is kinda slick that an old DOS program can invoke real Windows things.
John
Sorry,did nor work for a url only. however the next line does!
start
Works under win2K, as does just the URL.
I don't know how to open the default browser pointing to, say, a jpg though (assuming that some other application is the default for .jpg). Probably somewhat more complex.
Best regards, Spehro Pefhany
I meant open the *default* browser (whatever program or path that might be on today) to look at a jpg (even though it's not the default application that launches when you click on a .jpg). I suppose a not- very-roundabout method would be to write out a little mimimally compliant html file with the jpg appropriately mentioned in it, and use 'start' on that temporary file.
Yes, it's pretty fast to look at multiple pics too, although slower to load than ACDSEE. The price is right.
All those backward compatibility barnacles have their plusses.
Best regards, Spehro Pefhany
\\path\\ie.exe
Just a guess. I don't do Windows.
No, he's looking for a command that will open "the default browser", whatever you have that assigned to in the OS preferences; it could be any of dozens, although there are only about 4 or 5 most-popular ones.
I'm not on doze now, but I think someone mentioned: :>open /path/thepictureIwant.jpg , but that would open it with the default jpg viewer, not the default browser. Someone mentioned wrapping that in an HTML stub, like: thepictureIwant.jpg
title="thepictureIwant.jpg" alt="Sorry, apparently your browser doesn't support .jpg files =:-O" border="0"
Save that as thepictureIwant.html, and change the command line to: :>open /path/thepictureIwant.html. Once you have the page, it's trivially easy to make a shortcut to it on your desktop - just right-drag it and select "create shortcut here" from the pop-up menu.
Hope This Helps! Rich
You're right. That one slipped by me.
I assumed that the OP knew which browser the default was, but in the event the intention is to create a process or program to be run by others, one would have to look that up. I'm guessing that the correct way would be to get the info out of the registry. I don't know of a 'command line' function that will take a file type (.html or .jpeg for example) and return the appropriate command name and path from the registry. That would seem to be the best way.
...
I found this once while looking for a way to make a CD that autoruns:
Apparently it's a little program that does just that - finds the default browser and opens whatever page you tell it to. You'd have to include it with your app, if you're distributing something. I haven't bothered to look up the licensing stuff, but I think he's giving it away.
Cheers! Rich
I think this program just calls ShellExecute. It will open whichever program is associated, not just the browser.
Eg. browsercall test.txt opens UltraEdit on my machine (if test.txt exists).
Best regards, Spehro Pefhany
Have something to add? Share your thoughts — no account required.
Ask the community — no account required