Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Args w/ HTML WMI

Status
Not open for further replies.

Falcon99

Programmer
Dec 3, 2002
164
US
I would like to create a href link to a VBS script file and also passing an argument with it.
I haven't found a solution or even if it's possible.

---Client Side---
<a href="runscript.vbs 'argument'">Run Script</a>


This definately does not work, but maybe you can see what I'm trying to achieve.
Is it possible to do it in a vbscript subroutine on client side?

Thanks
 
Provided that security level permits that you may link to a function which instantiate a WScript.Shell object and call the Run method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PH,
Thanks for your response. I know security is not the issue because I can get it to work without an argument (hardwired).

I know it's a syntax issue, just don't know how to pass it on. Apostrophes trip up HTML and delimiters like ? or & trip up the script.

TIA
 
This is how in general to do it in vbs (ie only) and the security issue also means browser's security zone setting.
[tt]
<a href="javascript:void(0)" onclick="runit">Run Script</a>
[/tt]
and the handling.
[tt]
<script language="vbscript">
sub runit
createobject("wscript.shell").run "runscript.vbs arg1 arg2"
end sub
</script>
[/tt]
 
Thanks, tsuji, that got me off in the right direction.

I had to modify it slightly:

createobject("wscript.shell").run "cmd /C c:\localpath\runscript.vbs " & arg1)

(arg1 being passed to the sub from the link.)



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top