Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Network path not found

Status
Not open for further replies.

dbsquared

Programmer
Nov 7, 2002
175
US
I have a simple JavaScript that is causing me headaches.
Here is the code

Code:
<script language="javascript" type="text/javascript">
    function RunProg(CommandLine)
        {
         var ws = new ActiveXObject("WScript.Shell");
         ws.run(CommandLine,1,false);
         return;
    }
</script>
this works perfectly if the structure of the path is like this

\\\\server\\sharename\\MailMerge\\mailmerge.exe
however if there is a space in the name like this:
\\\\server\\share name\\Mail Merge\\mailmerge.exe

it gives the error The Network path was not found.
I have scoured this site and the internet to no avail i am hoping someone can help me format the path so that it can have spaces in it as this will be the case.


Thanks everyone for your help

To go where no programmer has gone before.
 
I think spaces must be represented as %20.

_________________
Bob Rashkin
 
Thank you for your response.
I have tried the %20 and I still get the same error.

DO you have any other suggestions?

Thanks

To go where no programmer has gone before.
 
What happens if you put the offending string in quotes?

_________________
Bob Rashkin
 
There can be quoting problem even we know it needs to add: but how to add quote to it?

If it is called by some event handler, say on<event> (substitute <event> to whatever event it really is), you can do any one of these or some valid variants.
[tt]
on<event>="RunProg('\x22\\\\server\\share name\\Mail Merge\\mailmerge.exe\x22')"
on<event>='RunProg("\x22\\\\server\\share name\\Mail Merge\\mailmerge.exe\x22")'
on<event>="RunProg('&#x22;\\\\server\\share name\\Mail Merge\\mailmerge.exe&#x22;')"
on<event>='RunProg("&#x22;\\\\server\\share name\\Mail Merge\\mailmerge.exe&#x22;")'

on<event>='RunProg("\"\\\\server\\share name\\Mail
Merge\\mailmerge.exe\"")'
[/tt]
 
worked like a charm thanks a bunch tsuji

To go where no programmer has gone before.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top