Faraz Shah Khan

MCP, MCAD.Net, MCSD.Net, MCTS-Win, MCTS-Web, MCPD-Web

Javascript to open application on client's machine

Long time back I was wondering if some how I will be able to open any application through my website on client's machine. Finally I came to know that yes it is possible and I will end up with this code.

Following code will open up notepad on client's machine. Before opening the file it will prompt the user, if the user accepts then it will opened. As of now it worked on windows with explorer only.

<script> 
     function go()
    {
         
w = new ActiveXObject("WScript.Shell");
         
w.run('notepad.exe');
         
return true;
    } 
</script>


<form>
          Run Notepad (Window with explorer only)
         
<input type="button" value="Go" onClick="return go()">
</form>

Comments

Mojtaabaa said:

what credential does it need?is it always enabled?

what about security notifications?

# April 29, 2008 4:22 AM

roshan said:

hello,

your code creates a task on client machine but than i have to manually go there and tick the "Run only if logged on" check box to actually run it..

is there a way to do this ticking programatically??? please help.....

# May 23, 2008 5:24 AM

knurly said:

Great! Now I'll continue my search to find a way to open link files (.txt) with notepad

# May 25, 2009 6:35 PM

Ejaz said:

Can it be used to open any other application like adobe or some other application? I am trying to open one of the Software tool through this and it is not working.

The exact address of the .exe file is Program Files/tools/mmt.exe and it is not working.

Any idea how can we make it work?

Its working fine for notepad and cmd line.

# October 14, 2009 8:33 PM

Mahuya Nargis said:

I am trying to prepare a JAVASCRIPT to run any .exe from remote server using any browser(like IE, FF,Chrome). My script is working fine in IE.

So, do have any idea how to prepare a single JAVASCRIPT to execute any .exe from remote server using any browser?

# July 11, 2011 3:45 AM

Nil said:

How can I use javascript to open specific program, say for example, Outlook. Here are specific requirements.

1. Check if outlook is already open, then get it, else open it.

2. Create a new mail with server supplied details (to, subject, body, attachment) and use client setting for getting signature.

3. The mail should be sent from Client's outlook machine.

I hope you can help me out.

Thanks in advance!

# February 15, 2012 3:59 PM

farazsk11 said:

@Nil

You can try using this.

<a href="mailto:xyz@example.com?cc=xyzcc@example.com&subject=Test%20Email&body=Test%20body">Send email</a>

It should bring up New Email in outlook with pre-populated information in the fields.

Hope it will help.

# February 15, 2012 5:19 PM

Cheney said:

Would love to always find out updated outstanding blog !

.

# December 21, 2012 8:08 PM

Sessions said:

I’d must verify with you here. Which isn’t

something I often do! I enjoy studying a publish that can make people

think. Also, thanks for permitting me to remark!

# January 3, 2013 2:37 PM

Ruby said:

I just like that the efforts you have put in this, regards for all that the great articles .

# January 17, 2013 4:16 PM

Graf said:

I’ve viewed some different blog posts with regards to this topic, and I must

state that yours shows the most insight. Thanks a ton for expressing your opinions

with everyone here.

# March 19, 2013 8:25 AM