How to run an executable from a Web page

Discussion in 'Javascript' started by Johnny, Oct 13, 2004.

  1. Johnny

    Johnny Guest

    How do I create a link on a Web page on my hard drive that will run an
    executable file on my hard drive?

    For example, let's say I create runpoodle.htm and save it to my hard
    drive, and let's also say I have an executable file on the root of C
    named c:\poodle.exe.

    How can I create a link of some sort on runpoodle.htm that will run
    poodle.exe on c:\ ?

    Better yet, can I specify a data file that poodle.exe will open after it
    starts?

    I use Windows XP Pro, and when I create a simple href anything like this

    <a href="file:\\c:\poodle.exe"> Run POODLE.EXE</a>

    the result is that Windows opens a security warning box asking whether I
    want to download poodle.exe.

    If you need any other information, please let me know.

    If this is not the appropriate newsgroup for this question, can you
    suggest which ones I should try?

    Thanks.

    --Johnny
    johnnyg aattssiiggnn kc.rr.com
     
    Johnny, Oct 13, 2004
    #1
    1. Advertising

  2. Johnny

    kaeli Guest

    In article <yYbbd.11845$-kc.rr.com>,
    enlightened us with...
    > How do I create a link on a Web page on my hard drive that will run an
    > executable file on my hard drive?
    >


    Make an HTA.
    (hypertext application)
    Use the windows shell object to open anything you want and pass any params
    you want.
    Most examples on the net are in VBScript/WSH (windows script host). You can
    use JScript or javascript if you want, but the examples are fewer and further
    between.

    HTAs are not subject to the restrictions of regular internet .html files.
    They don't run in the internet security zone.

    An HTA can be complicated, or it can just look like any other HTML file, but
    with a .hta extension.

    Here's a really simple one I had laying around from playing. It just opens
    Excel.

    testExcel.hta
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <HTML>
    <HEAD>
    <TITLE>Run Executable HTA</TITLE>
    </HEAD>
    <body bgcolor=#565656>
    <script language="javascript" type="text/javascript">
    var oShell = new ActiveXObject("WScript.Shell");
    var prog = "C:\\Program Files\\Microsoft Office\\Office\\Excel.exe";
    oShell.run ('"'+prog+'"',1);
    window.close();
    </script>
    </BODY>
    </HTML>

    --
    --
    ~kaeli~
    Synonym: the word you use in place of a word you can't
    spell.
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
     
    kaeli, Oct 13, 2004
    #2
    1. Advertising

  3. Johnny

    Hywel Guest

    In article <yYbbd.11845$-kc.rr.com>, Johnny says...
    > How do I create a link on a Web page on my hard drive that will run an
    > executable file on my hard drive?


    You can't.


    > If this is not the appropriate newsgroup for this question,


    It probably isn't.


    > can you
    > suggest which ones I should try?


    I doubt there are any. Think about this:
    <a href="file://c/windows/system32/format c:">Home</a>

    --
    Hywel

    http://sponsorhywel.org.uk/
     
    Hywel, Oct 13, 2004
    #3
  4. Johnny

    kaeli Guest

    In article <>,
    enlightened us with...
    > In article <yYbbd.11845$-kc.rr.com>, Johnny says...
    > > How do I create a link on a Web page on my hard drive that will run an
    > > executable file on my hard drive?

    >
    > You can't.
    >


    Sure you can.
    There are a f-load of caveats about it, though.

    The OP was talking about a page on his own computer to run a program resident
    on his own computer. That's easy to do. See my post.
    It is, however, not at all recommended for general internet use, nor is it
    cross-browser or cross-platform.

    --
    --
    ~kaeli~
    Never say, "Oops!"; always say, "Ah, interesting!"
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
     
    kaeli, Oct 13, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    15
    Views:
    511
    Dave Thompson
    Aug 21, 2006
  2. pratap
    Replies:
    20
    Views:
    791
    Flash Gordon
    Mar 7, 2007
  3. Jason Cavett
    Replies:
    8
    Views:
    658
    Sanjay
    May 16, 2007
  4. JPastor
    Replies:
    1
    Views:
    396
  5. Replies:
    0
    Views:
    462
Loading...

Share This Page