Embedded space characters

Results 1 to 3 of 3

Thread: Embedded space characters

  1. #1
    Join Date
    Dec 1969
    Posts
    28

    Default Embedded space characters

    Hi,<BR><BR>I am trying to use javaScript and the WSH to execute an external application from within an asp page. The problem I have is that there is an imbedded space in the path (i.e. "Program Files"). When using vbScript it was a simple matter to encapsulate the path and application filename within double-quotes (using chr(34)) - but I can&#039;t find how I can accomplish the same thing within JavaScript.<BR><BR>Can you help me with this problem?<BR><BR>tia,<BR>Mitch <BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    18,177

    Default RE: Embedded space characters

    theObject.Execute(&#039;\"C:Program Files est.exe\"&#039;);<BR><BR>I think that should work.

  3. #3
    Join Date
    Dec 1969
    Posts
    96,019

    Default OOPS! BUG!

    First of all, a pair of simple rules:<BR><BR>If a string in JS is enclosed in &#039;...&#039; then you can have " characters embedded in the string and do nothing special.<BR><BR>If a string in JS is enclosed in "..." then you can have &#039; characters embedded in the string and do nothing special.<BR><BR>*************<BR><BR>The goof, though, is that you *cannot* use characters in JS strings unless you "double" them up!<BR><BR>In a string such as &#039;"C:Program Files est.exe"&#039;, the " " will be seen as a TAB character! (Same as CHR(9) in VBScript.)<BR><BR>You surely don&#039;t want that!<BR><BR>So...<BR><BR>theObject.Execute(&#039; "C:\Program Files\test.exe"&#039;);<BR><BR>Hokay? If you really insisted on enclosing the string in "...", instead, then you could do:<BR><BR>theObject.Execute("\"C:\Program Files\test.exe"\");<BR><BR>But why?<BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •