Re: Launch chm file on WS within HTML
From: Chris \( Val \) (chrisval_at_bigpond.com.au)
Date: 03/21/04
- Next message: Ray Hinse: "Re: Launch chm file on WS within HTML"
- Previous message: Yuri Weinstein \(HotMail\): "Automatically login a user from 'at'"
- In reply to: Ray Hinse: "Re: Launch chm file on WS within HTML"
- Next in thread: Ray Hinse: "Re: Launch chm file on WS within HTML"
- Reply: Ray Hinse: "Re: Launch chm file on WS within HTML"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 21 Mar 2004 20:49:02 +1100
Hi Ray.
In VB or VBScript, we use an additional double quote to
escape another. However, in Java Script, the rules are
a little different in terms of what character to use to
escape another. In this case, I you want to use the
backslash escape character before backslash '\'(path
separator, as well as the double quote to make the whole
thing one complete argument). For example:
oShell.run """c:\WSH Script\TechNet Script Center\scriptcenter.chm"""
The above would now become:
oShell.run( "\"c:\\WSH Script\\TechNet Script Center\\scriptcenter.chm\"" );
The interpreter now sees this as:
"c:\WSH Script\TechNet Script Center\scriptcenter.chm"
The backslash character is commonly used in C and C++ as well as
Java, for exactly thes kind of situation(s).
Cheers.
Chris Val
"Ray Hinse" <rhinse@comcast.net> wrote in message news:5397c.50444$1p.848733@attbi_s54...
| Thank you for that 'more than I expected' explanation.
|
| Since I am running on a Windows 2000 system, the explanation sort of begs the
| question 'why do I need the double quotes within quotes?' The command line cd
| command certainly works without resorting to the 8.3 filenames but maybe that's
| the only place where it works. Nevertheless, your solution certainly works
| for VBS.
|
| Now, if you could proffer a solution for JScript, that would work equally well
| I could consider my research complete. The """ solution will not work in JScript
| since anytime it encounters a "", it reads as an empty string. The normal solution
| to this in JScript is to use alternating single and double quotes (" ' " " ' ").
|
| oShell.run " ' "c:\WSH Script\TechNet Script Center\scriptcenter.chm" ' "; seems to
| work but on page load I get an error: expected ; at the point oShell.run ^" ' ".
|
| Thank you again for your excellent input!
| And Cheers to you!
|
| "Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
| news:c3j37i$285cqc$1@ID-110726.news.uni-berlin.de...
| > "Ray Hinse" <rhinse@comcast.net> wrote in message
| > news:ZA37c.50907$KO3.173145@attbi_s02...
| > | OOPS! I spoke too soon. I misread your recommendation
| > | and only surrounded the file path with two double quotes.
| > | Three double quotes (""") works well. Maybe you could explain
| > | a little more thoroughly why I need three?
| >
| > Hi Ray.
| >
| > It all has to do with the way windows parses the
| > command line arguments with spaces, and long ones
| > at that. This is where the DOS 8.3 naming convention
| > comes into play.
| >
| > For example, if a path was longer than 8 characters
| > and had spaces in it, it would get resolved to something
| > a lot shorter.
| >
| > For example, if you run the 'DIR' command under Windows
| > 95, Windows 98 or Windows ME MS-DOS, you might see something
| > like this:
| >
| > progra~1
| >
| > This is supposed to be 'Program Files', and if I wanted to
| > change to that directory, I would have to type:
| >
| > C:\> cd progra~1
| >
| > Or
| >
| > C:\> cd "program files"
| >
| > When you use three double quotes, as in:
| >
| > """c:\WSH Script\TechNet Script Center\scriptcenter.chm"""
| >
| > The string is actually resolved to look like this:
| >
| > "c:\WSH Script\TechNet Script Center\scriptcenter.chm"
| >
| > Preceding one double quote with another, is said to escape
| > the one following it.
| >
| > Surrounding a command argument like this with double quotes,
| > means to treat it as one long command argument, rather than
| > split it up into individual arguments where ever it sees white
| > space, or long file names.
| >
| > Windows 2000 and XP are not affected by this naming convention
| > at the command prompt, and you can do:
| >
| > C:\> cd Program files
| >
| > and it will work fine, however, I don't think it works for all
| > commands, so it is best to surround your command line argument
| > with double quotes.
| >
| > The best way to see exactly what I mean by escaping characters,
| > is (if you have visual basic installed), type the following
| > into the editor in some suitable sub, etc...
| >
| > Debug.Print """c:\WSH Script\TechNet Script Center\scriptcenter.chm"""
| >
| > The output in the Debug window should now look like this:
| >
| > "c:\WSH Script\TechNet Script Center\scriptcenter.chm"
| >
| > Hope this helps.
| >
| > Cheers.
| > Chris Val
| >
| >
|
|
- Next message: Ray Hinse: "Re: Launch chm file on WS within HTML"
- Previous message: Yuri Weinstein \(HotMail\): "Automatically login a user from 'at'"
- In reply to: Ray Hinse: "Re: Launch chm file on WS within HTML"
- Next in thread: Ray Hinse: "Re: Launch chm file on WS within HTML"
- Reply: Ray Hinse: "Re: Launch chm file on WS within HTML"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|