Open With from a command line

  • Thread starter Thread starter Franc Zabkar
  • Start date Start date
F

Franc Zabkar

Guest
In Explorer, highlighting a particular file and r-clicking it while
holding down the Shift key brings up a context menu with an "Open
with" option.

Is there any way I can automate this via a single command line?

I'm thinking of something like this ...

some_command.exe /option_1 ... /option_n %1

.... where %1 is the file I wish to open.

Would rundll32.exe or explorer.exe have appropriate command line
options?

- Franc Zabkar
--
Please remove one 'i' from my address when replying by email.
 
Re: Open With from a command line


"Franc Zabkar" <fzabkar@iinternode.on.net> wrote in message
news:a650f4h3ihfqji301uqhao0t4lpk18mpdv@4ax.com...
| In Explorer, highlighting a particular file and r-clicking it while
| holding down the Shift key brings up a context menu with an "Open
| with" option.
|
| Is there any way I can automate this via a single command line?
|
| I'm thinking of something like this ...
|
| some_command.exe /option_1 ... /option_n %1
|
| ... where %1 is the file I wish to open.
|
| Would rundll32.exe or explorer.exe have appropriate command line
| options?
|
| - Franc Zabkar
| --
| Please remove one 'i' from my address when replying by email.

Well, couldn't that be accomplished by creating your specialty handling as
a Send To Item with "whatever your intended handler" and "options" would be?
It would seem to be rather difficult to attend to all the specific
variables that might be involved pursuant each "handler", though I suppose
you could make sub-context choices for each...

The registry COULD be modified to contain certain aspects related to each
particular file type, but gees that seems like a long way around just to
avoid a little typing... unless I'm missing something you're attempting to
address in this discussion.

--
MEB
http://peoplescounsel.org
a Peoples' counsel
_ _
~~
 
Re: Open With from a command line

On Sat, 11 Oct 2008 00:21:20 -0400, "MEB" <meb@not here@hotmail.com>
put finger to keyboard and composed:

>
>"Franc Zabkar" <fzabkar@iinternode.on.net> wrote in message
>news:a650f4h3ihfqji301uqhao0t4lpk18mpdv@4ax.com...
>| In Explorer, highlighting a particular file and r-clicking it while
>| holding down the Shift key brings up a context menu with an "Open
>| with" option.
>|
>| Is there any way I can automate this via a single command line?
>|
>| I'm thinking of something like this ...
>|
>| some_command.exe /option_1 ... /option_n %1
>|
>| ... where %1 is the file I wish to open.
>|
>| Would rundll32.exe or explorer.exe have appropriate command line
>| options?
>|
>| - Franc Zabkar
>
> Well, couldn't that be accomplished by creating your specialty handling as
>a Send To Item with "whatever your intended handler" and "options" would be?
> It would seem to be rather difficult to attend to all the specific
>variables that might be involved pursuant each "handler", though I suppose
>you could make sub-context choices for each...
>
> The registry COULD be modified to contain certain aspects related to each
>particular file type, but gees that seems like a long way around just to
>avoid a little typing... unless I'm missing something you're attempting to
>address in this discussion.


What I'm trying to do is to give myself the option of sending a URL to
one of several browsers. For example, in my newsreader, Agent, when I
click on a HTTP link, it launches my default browser, Opera. To send
the link to a different browser, I need to launch that browser and
then cut and paste the URL into its address bar. This is tedious.

What I want to do is to make the above command line my default
application for handling .HTML URLs. Then I can use it to redirect the
URL to any browser I choose.

- Franc Zabkar
--
Please remove one 'i' from my address when replying by email.
 
Re: Open With from a command line

Why not just write a little VB application? It's only a few lines of code.
--
Jeff Richards
MS MVP (Windows - Shell/User)
"Franc Zabkar" <fzabkar@iinternode.on.net> wrote in message
news:tte0f4p5egs9la2qplb2nlbkp3bceegni7@4ax.com...
> On Sat, 11 Oct 2008 00:21:20 -0400, "MEB" <meb@not here@hotmail.com>
> put finger to keyboard and composed:
>
>>
>>"Franc Zabkar" <fzabkar@iinternode.on.net> wrote in message
>>news:a650f4h3ihfqji301uqhao0t4lpk18mpdv@4ax.com...
>>| In Explorer, highlighting a particular file and r-clicking it while
>>| holding down the Shift key brings up a context menu with an "Open
>>| with" option.
>>|
>>| Is there any way I can automate this via a single command line?
>>|
>>| I'm thinking of something like this ...
>>|
>>| some_command.exe /option_1 ... /option_n %1
>>|
>>| ... where %1 is the file I wish to open.
>>|
>>| Would rundll32.exe or explorer.exe have appropriate command line
>>| options?
>>|
>>| - Franc Zabkar
>>
>> Well, couldn't that be accomplished by creating your specialty handling
>> as
>>a Send To Item with "whatever your intended handler" and "options" would
>>be?
>> It would seem to be rather difficult to attend to all the specific
>>variables that might be involved pursuant each "handler", though I suppose
>>you could make sub-context choices for each...
>>
>> The registry COULD be modified to contain certain aspects related to each
>>particular file type, but gees that seems like a long way around just to
>>avoid a little typing... unless I'm missing something you're attempting to
>>address in this discussion.

>
> What I'm trying to do is to give myself the option of sending a URL to
> one of several browsers. For example, in my newsreader, Agent, when I
> click on a HTTP link, it launches my default browser, Opera. To send
> the link to a different browser, I need to launch that browser and
> then cut and paste the URL into its address bar. This is tedious.
>
> What I want to do is to make the above command line my default
> application for handling .HTML URLs. Then I can use it to redirect the
> URL to any browser I choose.
>
> - Franc Zabkar
> --
> Please remove one 'i' from my address when replying by email.
 
Re: Open With from a command line

Jeff may have the best idea.
I haven't used such an old version of Agent as yours for a while, so I
doubt it has an Option to use more than one program to open HTML
files. I don't even see my Agent has that option.

....Alan
--
Alan Edwards, MS MVP Windows - Internet Explorer
http://dts-l.com/index.htm




On Sat, 11 Oct 2008 16:42:06 +1100, in
microsoft.public.win98.gen_discussion, Franc Zabkar
<fzabkar@iinternode.on.net> wrote:


>What I'm trying to do is to give myself the option of sending a URL to
>one of several browsers. For example, in my newsreader, Agent, when I
>click on a HTTP link, it launches my default browser, Opera. To send
>the link to a different browser, I need to launch that browser and
>then cut and paste the URL into its address bar. This is tedious.
>
>What I want to do is to make the above command line my default
>application for handling .HTML URLs. Then I can use it to redirect the
>URL to any browser I choose.
>
>- Franc Zabkar
 
Re: Open With from a command line

Franc Zabkar wrote:

> What I'm trying to do is to give myself the option of sending a URL to
> one of several browsers. For example, in my newsreader, Agent, when I
> click on a HTTP link, it launches my default browser, Opera. To send
> the link to a different browser, I need to launch that browser and
> then cut and paste the URL into its address bar. This is tedious.
>
> What I want to do is to make the above command line my default
> application for handling .HTML URLs. Then I can use it to redirect the
> URL to any browser I choose.
>
> - Franc Zabkar


Maybe not what you want but you could use FastExplorer to create a context
menu for htm, .html, .url, etc. and put whatever apps you wish on that
context menu. If you didn't want to keep FE, an examination of what it did
in creating the menu/associations might lead you to your solution. Also,
the author - Alex Yakovlev - has always been helpful and responsive to
me...perhaps he can help you.

http://thesoftpro.tripod.com/downloads/index.htm

--

dadiOH
____________________________

dadiOH's dandies v3.06...
....a help file of info about MP3s, recording from
LP/cassette and tips & tricks on this and that.
Get it at http://mysite.verizon.net/xico
 
Re: Open With from a command line

If I understand the problem, a context menu won't help as the connection is
occurring within the application (Agent, in this case) and unless that
application recognises and handles context menu items, no amount of fiddling
with the registry is going to accomplish what OP wants. Agent is simply
requesting the OS to do the equivalent of a double-click in Explorer. To
allow a selection it would have to request the OS to do the equivalent of a
right-click, and that would require an internal change within Agent (if it
can be done at all).
--
Jeff Richards
MS MVP (Windows - Shell/User)
"dadiOH" <dadiOH@invalid.com> wrote in message
news:OpjSji4KJHA.5436@TK2MSFTNGP05.phx.gbl...
> Franc Zabkar wrote:
>
>> What I'm trying to do is to give myself the option of sending a URL to
>> one of several browsers. For example, in my newsreader, Agent, when I
>> click on a HTTP link, it launches my default browser, Opera. To send
>> the link to a different browser, I need to launch that browser and
>> then cut and paste the URL into its address bar. This is tedious.
>>
>> What I want to do is to make the above command line my default
>> application for handling .HTML URLs. Then I can use it to redirect the
>> URL to any browser I choose.
>>
>> - Franc Zabkar

>
> Maybe not what you want but you could use FastExplorer to create a context
> menu for htm, .html, .url, etc. and put whatever apps you wish on that
> context menu. If you didn't want to keep FE, an examination of what it
> did in creating the menu/associations might lead you to your solution.
> Also, the author - Alex Yakovlev - has always been helpful and responsive
> to me...perhaps he can help you.
>
> http://thesoftpro.tripod.com/downloads/index.htm
>
> --
>
> dadiOH
> ____________________________
>
> dadiOH's dandies v3.06...
> ...a help file of info about MP3s, recording from
> LP/cassette and tips & tricks on this and that.
> Get it at http://mysite.verizon.net/xico
>
>
>
 
Re: Open With from a command line

"Franc Zabkar" <fzabkar@iinternode.on.net> wrote in message news:a650f4h3ihfqji301uqhao0t4lpk18mpdv@4ax.com...
> In Explorer, highlighting a particular file and r-clicking it while
> holding down the Shift key brings up a context menu with an "Open
> with" option.
>
> Is there any way I can automate this via a single command line?
>
> I'm thinking of something like this ...
>
> some_command.exe /option_1 ... /option_n %1
>
> ... where %1 is the file I wish to open.
>
> Would rundll32.exe or explorer.exe have appropriate command line
> options?


This works.
rundll32.exe shell32,OpenAs_RunDLL c:\config.sys

I haven't tried, but I assume this would work to pass the variable;
rundll32.exe shell32,OpenAs_RunDLL %L

%L attempts to pass the long name, %1 is the short 8.3 name.
 
Re: Open With from a command line

I can't say about Agent but in OE I get a context menu when I right click a
link. One would think that one would be spewed forth with Agent too :)

dadiOH


Jeff Richards wrote:
> If I understand the problem, a context menu won't help as the
> connection is occurring within the application (Agent, in this case)
> and unless that application recognises and handles context menu
> items, no amount of fiddling with the registry is going to accomplish
> what OP wants. Agent is simply requesting the OS to do the
> equivalent of a double-click in Explorer. To allow a selection it
> would have to request the OS to do the equivalent of a right-click,
> and that would require an internal change within Agent (if it can be
> done at all).
>> Franc Zabkar wrote:
>>
>>> What I'm trying to do is to give myself the option of sending a URL
>>> to one of several browsers. For example, in my newsreader, Agent,
>>> when I click on a HTTP link, it launches my default browser, Opera.
>>> To send the link to a different browser, I need to launch that
>>> browser and then cut and paste the URL into its address bar. This
>>> is tedious. What I want to do is to make the above command line my
>>> default
>>> application for handling .HTML URLs. Then I can use it to redirect
>>> the URL to any browser I choose.
>>>
>>> - Franc Zabkar

>>
>> Maybe not what you want but you could use FastExplorer to create a
>> context menu for htm, .html, .url, etc. and put whatever apps you
>> wish on that context menu. If you didn't want to keep FE, an
>> examination of what it did in creating the menu/associations might
>> lead you to your solution. Also, the author - Alex Yakovlev - has
>> always been helpful and responsive to me...perhaps he can help you.
>>
>> http://thesoftpro.tripod.com/downloads/index.htm
>>
>> --
>>
>> dadiOH
>> ____________________________
>>
>> dadiOH's dandies v3.06...
>> ...a help file of info about MP3s, recording from
>> LP/cassette and tips & tricks on this and that.
>> Get it at http://mysite.verizon.net/xico
 
Re: Open With from a command line

One does get a context menu in Agent but I see no way of configuring
it as Franc wants, though the Agent newsgroup would be a better place
to ask.
Newsgroup: alt.usenet.offline-reader.forte-agent

....Alan
--
Alan Edwards, MS MVP Windows - Internet Explorer
http://dts-l.com/index.htm



On Sat, 11 Oct 2008 09:00:47 -0400, in
microsoft.public.win98.gen_discussion, "dadiOH" <dadiOH@invalid.com>
wrote:

>I can't say about Agent but in OE I get a context menu when I right click a
>link. One would think that one would be spewed forth with Agent too :)
>
>dadiOH
>
>
>Jeff Richards wrote:
>> If I understand the problem, a context menu won't help as the
>> connection is occurring within the application (Agent, in this case)
>> and unless that application recognises and handles context menu
>> items, no amount of fiddling with the registry is going to accomplish
>> what OP wants. Agent is simply requesting the OS to do the
>> equivalent of a double-click in Explorer. To allow a selection it
>> would have to request the OS to do the equivalent of a right-click,
>> and that would require an internal change within Agent (if it can be
>> done at all).
>>> Franc Zabkar wrote:
>>>
>>>> What I'm trying to do is to give myself the option of sending a URL
>>>> to one of several browsers. For example, in my newsreader, Agent,
>>>> when I click on a HTTP link, it launches my default browser, Opera.
>>>> To send the link to a different browser, I need to launch that
>>>> browser and then cut and paste the URL into its address bar. This
>>>> is tedious. What I want to do is to make the above command line my
>>>> default
>>>> application for handling .HTML URLs. Then I can use it to redirect
>>>> the URL to any browser I choose.
>>>>
>>>> - Franc Zabkar
>>>
>>> Maybe not what you want but you could use FastExplorer to create a
>>> context menu for htm, .html, .url, etc. and put whatever apps you
>>> wish on that context menu. If you didn't want to keep FE, an
>>> examination of what it did in creating the menu/associations might
>>> lead you to your solution. Also, the author - Alex Yakovlev - has
>>> always been helpful and responsive to me...perhaps he can help you.
>>>
>>> http://thesoftpro.tripod.com/downloads/index.htm
>>>
>>> --
>>>
>>> dadiOH
>>> ____________________________
>>>
>>> dadiOH's dandies v3.06...
>>> ...a help file of info about MP3s, recording from
>>> LP/cassette and tips & tricks on this and that.
>>> Get it at http://mysite.verizon.net/xico

>
>
 
Re: Open With from a command line

Franc Zabkar <fzabkar@iinternode.on.net> wrote in
news:a650f4h3ihfqji301uqhao0t4lpk18mpdv@4ax.com:

> In Explorer, highlighting a particular file and r-clicking
> it while holding down the Shift key brings up a context
> menu with an "Open with" option.
>
> Is there any way I can automate this via a single command
> line?
>
> I'm thinking of something like this ...
>
> some_command.exe /option_1 ... /option_n %1
>
> ... where %1 is the file I wish to open.
>
> Would rundll32.exe or explorer.exe have appropriate command
> line options?
>
> - Franc Zabkar


Hi Franc

I might be missing something here, but I /think/ the following
free utility could be configured to "send" things (in this case
URL's) to specific programs, in this case browsers.

http://www.moonsoftware.com/files/legacy/FileTargets_141.exe

As a possible alternative, I also highly recommend URL Organizer
2 by Edward Leigh, which allows you to choose the browser you
will be opening the URL with, in addition to its other wonderful
options and features.

http://www.osolis.com/program.cgi?P2

Regards
t.


--
Those who cast the votes decide nothing. Those who count the
votes decide everything.
- Josef Stalin
 
Re: Open With from a command line

On Sat, 11 Oct 2008 08:50:27 -0400, "Bill Blanton"
<bblanton@REMOVEmagicnet.net> put finger to keyboard and composed:

>"Franc Zabkar" <fzabkar@iinternode.on.net> wrote in message news:a650f4h3ihfqji301uqhao0t4lpk18mpdv@4ax.com...
>> In Explorer, highlighting a particular file and r-clicking it while
>> holding down the Shift key brings up a context menu with an "Open
>> with" option.
>>
>> Is there any way I can automate this via a single command line?
>>
>> I'm thinking of something like this ...
>>
>> some_command.exe /option_1 ... /option_n %1
>>
>> ... where %1 is the file I wish to open.
>>
>> Would rundll32.exe or explorer.exe have appropriate command line
>> options?

>
>This works.
>rundll32.exe shell32,OpenAs_RunDLL c:\config.sys
>
>I haven't tried, but I assume this would work to pass the variable;
>rundll32.exe shell32,OpenAs_RunDLL %L
>
>%L attempts to pass the long name, %1 is the short 8.3 name.


Brilliant! It works well. I eventually received the same solution at
the Agent newsgroup, although I see this as a universal solution which
can be applied to other applications, eg my email client, Eudora.

BTW I had already noticed that when Explorer's Open With dialogue box
was open, typing Ctrl_Alt_Del showed that a task named "Open With" was
running, and Wintop showed rundll32.exe in its task list. Closing the
dialogue box terminated both tasks.

So it was clear that rundll32.exe could provide the solution, but I
had no idea how to proceed.

To answer the other questions in respect of a context menu, I have
already added "open with Opera", "open with Firefox", and open with
OffByOne" to Explorer's context menu for HTM and HTML file types, but
that's not what I was asking for. BTW, you don't need any third party
application to do this.

Just launch Explorer, go to View -> Folder Options -> File Types ->
type "H" and look for a HTML/HTM file type, highlight it, select Edit
-> New. Give the Action a name, eg ...

open local file with My_Browser

.... and type the command line for the "application used to perform
action".

For example, I use this for OffByOne:

"C:\Program Files\OffByOne\OB1.exe" "file://localhost/%1"

Leave "use DDE" unchecked.

BTW, Opera and Firefox don't require the "file://localhost/" prefix.

Thanks to all for your help.

- Franc Zabkar
--
Please remove one 'i' from my address when replying by email.
 
Back
Top