Start New Discussion within our Software Development Community

<a onclick=" window.open('C:/Documents and Settings/palanikumar.r/Desktop/Doc.bat','remarks','height=600,width=915,left=50,top=50')" ><input type="button" value="start" onClick="startclock('')"></a>
see, in the above coding i am using button to open a document file.
im opening it through the batch file..
the batch file contains

@echo off
c:
cd\
cd jdk1.5.0_05\bin
javac Doc.java
java Doc

Doc.java is a java program through this java program i am opening a word application

import java.io.*;

public class Doc
{
public static void main(String[] str)throws IOException
{
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "C:\\Program Files\\Microsoft Office\\OFFICE11\\WINWORD.exe");
}
}

when i clicking the button in the html file the batch file runs first and it calls the java program and then the word application open.
And my problem is when i am clicking the button the batch program is called at that time the file download dialog box is opening.

i dont want to open the dialogue box.
if possible pls help.

You are getting a download box, because the browser (I assume your on Windoof) does not know what to do with files that have an extension of ".bat", so it is asking you what it should do with it. You need to add a mime type for ".bat".

This entire action, is, however, wrong on so many levels (technical, practical, and security levels) that I cannot even begin to list them.

Edit: Or a mime type exists, but its action is save/download, in which case you simply need to cahgne the mime type. But see my above comment.

And, on a side note, why did you open a new thread for this, rather than simply replying to my post in your other thread?

This article has been dead for over six months. Start a new discussion instead.