Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

start command with file protocol strips link target

2 views
Skip to first unread message

Larry Barowski

unread,
Oct 7, 2004, 5:25:52 PM10/7/04
to
If I use the start command for an http address with a link target:

start "" "http://some_path/some_file.html#some_target"

it brings up a browser set to that address and link target, but

start "" "file://some_path/some_file.html#some_target"

brings up a browser set to that address with no link target. Is
there a simple way to work around this?


Message has been deleted

Larry Barowski

unread,
Oct 7, 2004, 8:27:57 PM10/7/04
to
> How about trying file:/// instead of file:// ?

Same thing. This is on XP.

The Java libraries give the URL representation of a file
as "file://". Is there some reason for an extra slash?


Ted Davis

unread,
Oct 7, 2004, 8:54:00 PM10/7/04
to

// is correct URL syntax if followed by a machine name - /// simply
indicates that the host name is being omitted and that localhost is to
be assumed. RFC 1738 explains the URL syntax, and RFC 2396 covers
URIs.


--
T.E.D. (tda...@gearbox.maem.umr.edu)

Mark V

unread,
Oct 7, 2004, 11:50:08 PM10/7/04
to

Best guess.
In case 1 you pass a string to a HTTP server that interprets it
(including the target reference) whereas for file:// you get the same
local action as
START "" "some_path/some_file.html#some_target"
(IOW START "" "some_path/some_file.html")
with only up to and including ".html" as significant. Where that
happens (truncated by System or ignored by local browser) is not clear.


Larry Barowski

unread,
Oct 8, 2004, 12:42:31 AM10/8/04
to

"Mark V" <notv...@nul.invalid> wrote in message
news:Xns957BF295CC...@216.77.188.18...

IE and Netscape won't drop the link target if called directly
with a file URL argument. It seems like Windows shouldn't
drop it, since a URL is a URL, whether http or file. It may
be dropped to determine the association for the file, but
should be added back on when the associated app is
started.

Anyway, what I'm looking for is a way to start a file URL
with a link target in the default browser on Windows from
the command line. Maybe this is not possible and I will
have to write some native glue code (the application that
will launch the browser is written in Java). That is fairly
simple - I was just hoping it was not necessary.


Mark V

unread,
Oct 8, 2004, 12:54:07 AM10/8/04
to
In alt.msdos.batch.nt Larry Barowski wrote:

>
> "Mark V" <notv...@nul.invalid> wrote in message
> news:Xns957BF295CC...@216.77.188.18...
>> In alt.msdos.batch.nt Larry Barowski wrote:
>>
>> > If I use the start command for an http address with a link
>> > target:
>> >
>> > start "" "http://some_path/some_file.html#some_target"
>> >
>> > it brings up a browser set to that address and link target, but
>> >
>> > start "" "file://some_path/some_file.html#some_target"
>> >
>> > brings up a browser set to that address with no link target. Is
>> > there a simple way to work around this?
>>
>> Best guess.
>> In case 1 you pass a string to a HTTP server that interprets it
>> (including the target reference) whereas for file:// you get the
>> same local action as
>> START "" "some_path/some_file.html#some_target"
>> (IOW START "" "some_path/some_file.html")
>> with only up to and including ".html" as significant. Where that
>> happens (truncated by System or ignored by local browser) is not
>> clear.
>
> IE and Netscape won't drop the link target if called directly
> with a file URL argument. It seems like Windows shouldn't

I use neither of those so... Opera (on W2K) acts as you have
described above. It drops or ignores the "#targetname" when passed
with "file:".

> drop it, since a URL is a URL, whether http or file. It may
> be dropped to determine the association for the file, but
> should be added back on when the associated app is
> started.

Actually if it were the OS I'd expect it was because if the "file:"
protocol handling since in the case described initially one is not
starting a file by extension association.

More clear now that this is most likely a browser-specific issue it
seems to me.

>
> Anyway, what I'm looking for is a way to start a file URL
> with a link target in the default browser on Windows from
> the command line. Maybe this is not possible and I will
> have to write some native glue code (the application that
> will launch the browser is written in Java). That is fairly
> simple - I was just hoping it was not necessary.

I see the need. It is curious behavior and I hope others will post
regarding their favorite browser's behavior as regards
ignoring/dicarding a passed target specification.

If I run across additional info., I'll post it here.


Mark V

unread,
Oct 8, 2004, 6:00:20 PM10/8/04
to

Got an answer from Opera Software.
"Ah, the old decoding problem. In several operating systems, it is
possible to have a file name with a "#" in it. So how does Opera
determine whether the "#" is part of the name or is an anchor? ..."

Opera just truncates at "#" in this case. Opera of course has a code
base that crosses many platforms. They might change this behavior in
the future. So it seems most likely that various browsers are the
determining factor.

Mark V

unread,
Oct 26, 2004, 7:49:00 PM10/26/04
to
In alt.msdos.batch.nt Larry Barowski wrote:

Larry, Still around?

I've a workaround you can try. Inellegant but can be done on the fly
and it works with Opera. Probably with others as well.

Applies to W2K, SP4, Opera Win32 7.54.3865,
though it should work on XP, W2K3 and possibly other MS operating
systems and possibly with other browsers.

Although this fails to reach the "target"
C:\START "" "file://localhost/C:/Foo/SomeHTMLdoc.html#The_Target"
(Opera snips at "#')
A possibly acceptable work-around is available. Namely, create a
.URL URL Shortcut file and START that instead.
======= cut === go.url ========
[InternetShortcut]
URL=file://localhost/C:/Foo/SomeHTMLdoc.html#The_Target

======= end cut ===============
C:\START "" "<path>\go.url"
(success)

And assuming .URL files are associated with Opera of course.
Or your browser (probably).

Larry Barowski

unread,
Oct 30, 2004, 2:33:22 AM10/30/04
to

"Mark V" <notv...@nul.invalid> wrote in message
news:Xns958ECA0012...@216.77.188.18...

> In alt.msdos.batch.nt Larry Barowski wrote:
>
> > If I use the start command for an http address with a link target:
> >
> > start "" "http://some_path/some_file.html#some_target"
> >
> > it brings up a browser set to that address and link target, but
> >
> > start "" "file://some_path/some_file.html#some_target"
> >
> > brings up a browser set to that address with no link target. Is
> > there a simple way to work around this?
>
> Larry, Still around?

I am now.

> I've a workaround you can try. Inellegant but can be done on the fly
> and it works with Opera. Probably with others as well.
>
> Applies to W2K, SP4, Opera Win32 7.54.3865,
> though it should work on XP, W2K3 and possibly other MS operating
> systems and possibly with other browsers.
>
> Although this fails to reach the "target"
> C:\START "" "file://localhost/C:/Foo/SomeHTMLdoc.html#The_Target"
> (Opera snips at "#')
> A possibly acceptable work-around is available. Namely, create a
> .URL URL Shortcut file and START that instead.
> ======= cut === go.url ========
> [InternetShortcut]
> URL=file://localhost/C:/Foo/SomeHTMLdoc.html#The_Target
>
> ======= end cut ===============
> C:\START "" "<path>\go.url"
> (success)
>
> And assuming .URL files are associated with Opera of course.
> Or your browser (probably).

This is great idea. Many thanks.


Larry Barowski

unread,
Oct 30, 2004, 3:48:34 AM10/30/04
to

"Larry Barowski" <MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND> wrote in
message news:10o6cje...@corp.supernews.com...

>
> > I've a workaround you can try. Inellegant but can be done on the fly
> > and it works with Opera. Probably with others as well.
> >
> > Applies to W2K, SP4, Opera Win32 7.54.3865,
> > though it should work on XP, W2K3 and possibly other MS operating
> > systems and possibly with other browsers.
> >
> > Although this fails to reach the "target"
> > C:\START "" "file://localhost/C:/Foo/SomeHTMLdoc.html#The_Target"
> > (Opera snips at "#')
> > A possibly acceptable work-around is available. Namely, create a
> > .URL URL Shortcut file and START that instead.
> > ======= cut === go.url ========
> > [InternetShortcut]
> > URL=file://localhost/C:/Foo/SomeHTMLdoc.html#The_Target
> >
> > ======= end cut ===============
> > C:\START "" "<path>\go.url"
> > (success)

Hmm. Doesn't work for IE or NS 7 on XP (goes to page, but not to
target). Strange that internet shortcuts with targets wouldn't work by
default on my system.

0 new messages