Jump to content

How can i make my path dynamic?


fmpfmpf

Recommended Posts

<html><head><script type="text/javascript" language="JavaScript">function LaunchCommand(){var launcher = new ActiveXObject("WScript.Shell");launcher.Run("file://C:/ColorCop.exe");window.open('','_self','');window.close();}</script></head><body><br><br><br><br><br><center><font size = 5>Click button to open file</font><br><br><input name="Command" value="Click me"onclick="LaunchCommand()" type="button"><body><center></html>The above attached is my .html code to open a .exe file in C:However, i wish to have both the .html and .exe file in the same folder. When i shift these 2 files to another location, the .html file will still link to the .exe file and still open it when clicked.How can i make this possible?TQ

Link to comment
Share on other sites

then don't have it reference the C: drive. if they are both in the same folder, then all you probably need is this:

launcher.Run("file://ColorCop.exe");

Link to comment
Share on other sites

That means the working directory for the shell is the user's desktop instead of the folder the HTML file is in. Look for a way to change the working directory in the shell to the same directory as the HTML file. I'm not sure how to use Javascript to get the path of the current file, but there might be a shell command you can use with the ActiveX object.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...