Ok I've banging my head off the desk on this one...
Why doesn't this work? I'm using it as the onclick event for a button in my HTA.
I've also changed the window to 1 and tried to see what was going on but the iRes result is 1 and nothing happens when the cmd window pops up. I've also tried setting the waitforreturn option to true and still nothing. If I remove the > redirection operator and filename, it works like a champ.
All lessons learned from the School of Hard Knocks........at least tuition is cheap.
Why doesn't this work? I'm using it as the onclick event for a button in my HTA.
Code:
<html>
<head>
[COLOR=#800000]<script type="text/vbscript">
sub mit()
set oShell = CreateObject("WScript.Shell")
iRes = oShell.run("ping 192.168.2.1 > pingres.txt", 0)
set oShell = Nothing
end sub
</script>[/color]
</head>
<body>
<form id="fform" name="fform">
<input type="button" name="btn" value="Ping" onclick="mit">
</form>
</body>
</html>
I've also changed the window to 1 and tried to see what was going on but the iRes result is 1 and nothing happens when the cmd window pops up. I've also tried setting the waitforreturn option to true and still nothing. If I remove the > redirection operator and filename, it works like a champ.
All lessons learned from the School of Hard Knocks........at least tuition is cheap.