Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All,
I am trying to call bat files using macros with the help of j script. But while trying to run the program exception is happens. Below is the jscript code i have used in macros.
<html>
<head>
<title>Run Exe or Bat files from HTA by Hackoo</title>
<HTA:APPLICATION
APPLICATIONNAME="Run Exe or Bat files from HTA by Hackoo"
ID="MyHTMLapplication"
VERSION="1.0"/>
</head>
<script>
function RunExe(){
var shell = new ActiveXObject("WScript.Shell");
var path = '"D:/run.bat"';
shell.run(path,1,false);
}
</script>
<input style="width: 170px; height:23px; color: white; background-color: #203040;
font-family:Book Antiqua;" type="button" Value="bat" onClick="RunExe();"
</html>
May be run it as this?
<script language="JavaScript" type="text/javascript">
MyObject = new ActiveXObject("WScript.Shell")
function Runbat()
{
MyObject.Run("\"C:\\Private\\Anil_ITPL\\Desktop\\welcometest.bat\"");
}
</script>
Hi Anil,
I have run this script, but it shoes syntax error like below
You can not write Script Tags over Module. May be this?
function Runbat() {
MyObject = new ActiveXObject("WScript.Shell")
{
MyObject.Run("\"C:\\Private\\Anil_ITPL\\Desktop\\welcometest.bat\"");
}
}
Dear All,
If possible, to call bat files through VBScript or any another ways please update me.
Regards
Hareesh.
Dear Anil,
Some exception is happens please have a look.
Regards,
Hareesh.
Hi,
If you want to execute only bat file
then you can use below command.
EXECUTE D:\temp\test.bat;
Regards,
For me, This is okay
Hi Prasanth,
I am run this code by using macros. It is not working properly please have a look.
Regards,
Hareesh.
Hi,
code is working, but while trying to execute exception is happens like 'Automation server can't create object'