View Full Version : open .exe
I have a HTML file from which I must open an .exe with an argument (the argument being an url). The problem is also that the .exe is not always located in the same place. It is however always located in the same place as the html file is.
Thanks in advance
12-15-2004, 09:23 PM
make the link to the exe relative...
<a href="#" onclick="location.href='file.exe'; return false" target="_blank">open file</a>
the critical part is the red text :)
12-16-2004, 04:02 AM
I have a HTML file from which I must open an .exe with an argument (the argument being an url).
You should look into WSH and HTA for this.
I looked into WSH, like you suggested and I found a way to open the .exe with a parameter:
test.html contains this: (amongst other things)
var myshell = new ActiveXObject( "WScript.shell" );
myshell.run( ' "c:/testfile.exe" '+varUrl+' ', 1, true );
That works perfect to open testfile.exe with the varUrl as parameter. The only problem now is that testfile.exe is not always in C: root, it IS always in the same location as test.html. So somehow I have to replace C: with something variable...any ideas?
The only problem now is that testfile.exe is not always in C: root, it IS always in the same location as test.html. So somehow I have to replace C: with something variable...any ideas?
then surely you can just drop the drive identifier from the file path:
myshell.run( ' "testfile.exe" '+varUrl+' ', 1, true );
well, tried that - and it seems that 'desktop' is the current directory. But that is NOT the directory the .exe is located... so that doesn't seem to work
you'll need to run a script to get the current drive and directory and then prepend that to the filename you're calling.
12-16-2004, 11:33 AM
if you are using activeX why dont you just get the currrent folder name?
//Determine the installed path
my_path = location.pathname;
my_path = my_path.substr(1,(my_path.lastIndexOf('\\')));
my_folder = XObject.GetFolder(my_path);
where XObject is whatever you call your activeX FileSystemObject
12-16-2004, 03:42 PM
That's about it for IE, although there's no reason to get the folder object.
An HTA is different. It allows for relative links with most MS automation objects, and has the commandLine property for getting a current path.
Script files are different as well, having ScriptFullName & ScriptName properties.
Unless you are willing to disable browser security settings, an HTA is probably what you're after.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.